typedef的用法02

时间:2021-09-07 18:42:07   收藏:0   阅读:68

#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;
}

原文:https://www.cnblogs.com/wang-xiao-shuai/p/15237427.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!