riojuan

Untitled

Feb 22nd, 2020
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. struct Books {
  5.    char  title[50];
  6.    char  author[50];
  7.    char  subject[100];
  8.    int   book_id;
  9. };
  10.  
  11. int main( ) {
  12.  
  13.    struct Books Book1;        /* Declare Book1 of type Book */
  14.    
  15.    /* book 1 specification */
  16.    strcpy( Book1.title, "C Programming");
  17.    strcpy( Book1.author, "Nuha Ali");
  18.    strcpy( Book1.subject, "C Programming Tutorial");
  19.    Book1.book_id = 6495407;
  20.  
  21.    /* print Book1 info */
  22.    printf( "Book 1 title : %s\n", Book1.title);
  23.    printf( "Book 1 author : %s\n", Book1.author);
  24.    printf( "Book 1 subject : %s\n", Book1.subject);
  25.    printf( "Book 1 book_id : %d\n", Book1.book_id);
  26.  
  27.       return 0;}
Advertisement
Add Comment
Please, Sign In to add comment