C语言结构体别名怎么定义?
答案:1 悬赏:20
解决时间 2021-01-20 02:45
- 提问者网友:我一贱你就笑
- 2021-01-19 02:15
C语言结构体别名怎么定义?
最佳答案
- 二级知识专家网友:刀戟声无边
- 2021-01-19 03:33
定义一个结构体,比如说就你这个
struct STU
{
int age;
struct STU *next;
};
然后我想定义一个结果提类型的指针,应该是struct STU *p;或者定义一个普通的结构体变量struct STU a;
比较麻烦,用typedef后
typedef struct STU
{
int age;
struct STU *next;
}linklist;
那么现在linklist就代表这个结构体,现在定义结果提指针linklist *p;就方便了
同样,把他定义成
typedef struct STU
{
int age;
struct STU *next;
}*linklist;
那么linklist就是代表这个结构体指针类型,linklist head;head就是结构体指针类型了;
struct STU
{
int age;
struct STU *next;
};
然后我想定义一个结果提类型的指针,应该是struct STU *p;或者定义一个普通的结构体变量struct STU a;
比较麻烦,用typedef后
typedef struct STU
{
int age;
struct STU *next;
}linklist;
那么现在linklist就代表这个结构体,现在定义结果提指针linklist *p;就方便了
同样,把他定义成
typedef struct STU
{
int age;
struct STU *next;
}*linklist;
那么linklist就是代表这个结构体指针类型,linklist head;head就是结构体指针类型了;
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯