typedef的用法02
作者:互联网
#include<stdio.h>
#include<string.h>
typedef struct Books {
char title[10];
char bookname[10];
char author[20];
int bookID;
}Book;
int main(int argc, const char *argv[])
{
Book book1; // 替换struct Books book1
strcpy(book1.title, "Cyuyan");
strcpy(book1.author, "zhagnsna");
strcpy(book1.bookname, "C语言速成");
book1.bookID = 234;
printf("%s\n", book1.title);
printf("%s \n %s\n%s\n %d\n", book1.title, book1.author, book1.bookname, book1.bookID);
return 0;
}
标签:02,typedef,bookID,title,int,用法,char,book1,strcpy 来源: https://www.cnblogs.com/wang-xiao-shuai/p/15237427.html