WAP to print information about a book using structure.

#include<stdio.h> #include<stdlib.h>

main() { struct book { char name[20]; int page; float price; };
struct book b1={"sahil",100,52.5};
 struct book *ptr;
 ptr=&b1;
 printf("%s %d %f",b1.name,b1.page,b1.price);
 printf("%s %d %f",ptr->name,ptr->page,ptr->price);
 system("pause");
}
Advertisements

Leave a comment

Filed under TUTORIALS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s