mystery demystified…:)…thanku
first define the size of string as u will enter book name which is a string not a character…
instead of %c use %s in both scanf & printf statement…
have a look on this code as i have made some minor changes as mentioned above…
#include "stdio.h"
struct book
{
char name[20];
float price;
int page;
}
b1,b2,b3;
int main()
{
printf("enter the data\n");
scanf("%s %f %d",&b1.name,&b1.price,&b1.page);
scanf("%s %f %d",&b2.name,&b2.price,&b2.page);
scanf("%s %f %d",&b3.name,&b3.price,&b3.page);
printf("%s %f %d\n",b1.name,b1.price,b1.page);
printf("%s %f %d\n",b2.name,b2.price,b2.page);
printf("%s %f %d\n",b3.name,b3.price,b3.page);
return 0;
}