Problem with scanf in a structure program
Posted on 2001-08-13
/*When I run this program the prog stops taking input after the..
..second scanf statement.???Why.
Also the in the output of the printf statement the the 2nd and 3rd..
outputs are really wierd.Why?????????
What is the reason for both these abnormal outcomes????*/
struct book b1,b2,b3;
printf("\nEnter names,prices and no. of pages of 3 books.\n");
scanf("%c %f %d",&b1.name,&b1.price,&b1.pages);
scanf("%c %f %d",&b2.name,&b2.price,&b2.pages);
scanf("%c %f %d",&b3.name,&b3.price,&b3.pages);
printf("\n%f %d %f",b1.price,b2.pages,b2.price);