C和Cpp在结构体上的区别(不包括面向对象的区别)
没有用typedef时候
C语言
// 方式一
#include <stdio.h>
struct Books {
int sal;
int id;
};
int main() {
struct Books book; // 声明一个叫做book的结构体
book.sal = 10;
book.id = 10010;
printf("%d %d", book.sal, book.id);
return 0;
}
// 方式二
#include <stdio.h>
原创
2022-01-03 22:42:11 ·
522 阅读 ·
0 评论