1. 结构体
C 中定义的结构体,不起别名的情况下使用时要添加 struct,C++ 可以不用添加 struct,直接使用定义的结构体名称。
struct Student{
int age;
char *name;
};
// C++ 不报错,C报错
Student GetName(){
}
// C 的写法
// struct Student GetName(){
// }
C 中定义的结构体,不起别名的情况下使用时要添加 struct,C++ 可以不用添加 struct,直接使用定义的结构体名称。
struct Student{
int age;
char *name;
};
// C++ 不报错,C报错
Student GetName(){
}
// C 的写法
// struct Student GetName(){
// }