C语言typedef

#include <stdio.h>
#include <string.h>

typedef struct Books {
   char title[50];
   char author[50];
   char subject[100];
   int book_id;
} Book;

int main( ) {

   Book book;

   strcpy( book.title, "C Programming");
   strcpy( book.author, "Nuha Ali"); 
   strcpy( book.subject, "C Programming Tutorial");
   book.book_id = 6495407;

   printf( "Book title : %s/n", book.title);
   printf( "Book author : %s/n", book.author);
   printf( "Book subject : %s/n", book.subject);
   printf( "Book book_id : %d/n", book.book_id);

   return 0;
}

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265160.html

(0)
上一篇 2022年6月7日
下一篇 2022年6月7日

相关推荐

发表回复

登录后才能评论