Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- struct Books {
- char title[50];
- char author[50];
- char subject[100];
- int book_id;
- };
- int main( ) {
- int i;
- struct Books Book[3];
- /* Declare Book1 of type Book /* Declare Book2 of type Book */
- for(i=0; i<3;i++)
- {
- scanf("%s",&Book[i].title);
- scanf("%s",&Book[i].author);
- scanf("%s",&Book[i].subject);
- scanf("%d",&Book[i].book_id);
- }
- /* book 1 specification */
- //scanf( "%s",&Book1.title);
- /* book 2 specification */
- /* print Book1 info */
- for(i=0; i<3; i++)
- {
- printf( "Book %d title : %s\n",i, Book[i].title);
- printf( "Book %d author : %s\n",i, Book[i].author);
- printf( "Book %d subject : %s\n",i, Book[i].subject);
- printf( "Book %d book_id : %d\n",i, Book[i].book_id);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement