Back To C Structures
//program to create a structure book with members (bookid,bookname,author and price) and input values from user and then display the values #include
#include
struct book { int bookid; char bookname[20]; char author[20]; float price; }; void main() { struct book b; //variable of structure book created clrscr(); printf("\nenter bookid "); scanf("%d",&b.bookid); printf("\nenter book name "); scanf("%s",b.bookname); printf("\nenter book author "); scanf("%s",b.author); printf("\nenter price of book "); scanf("%f",&b.price); printf("\ndispalying the values \n"); printf("\nbook id is %d",b.bookid); printf("\nbook name is %s",b.bookname); printf("\nauthor of book is %s",b.author); printf("\nprice of book is %f",b.price); getch(); }