typedef怎么用
#include <bits/stdc++.h>using namespace std;
typedef struct stu{
int age;
int score;
};
typedef struct t{
string name;
stu student;
};
int main(){
t teacher;
teacher.name = "Asdf";
teacher.student.age = 19;
teacher.student.score = 100;
printf("%s%d", teacher.name.c_str(), teacher.student.age);
return 0;
}
这个代码出错了 , 不知道该怎么改 , typedef 是不是就是给一个类型起一个名字 , 那跟define的区别在哪 typedef struct t{
string name;
stu student;
} tt; // tt别名 https://fishc.com.cn/forum.php?mod=redirect&goto=findpost&ptid=206480&pid=5663734
页:
[1]