1#includestdio.htypedef struct Student{int sid;char name[100];char sex;}* PST; // PST 等价于 struct Student * 定义的变量为指针int main(){struct Student st;PST ps = st;ps-sid = 99;printf(%d\n...

1
#include<stdio.h>
typedef struct Student
{
int sid;
char name[100];
char sex;
}* PST; // PST 等价于 struct Student * 定义的变量为指针
int main()
{
struct Student st;
PST ps = &st;
ps->sid = 99;
printf("%d\n", ps->sid);
return 0;
}
2
#include<stdio.h>
typedef struct Student
{
int sid;
char name[100];
char sex;
}* PST, ST; // PST 等价于 struct Student * 定义的变量为指针, ST 等价于 struct Student 定义的变量为普通的结构体变量
int main()
{
ST st; // struct Student st;
PST ps = &st; // struct Student * ps = &st;
ps->sid = 99;
printf("%d\n", ps->sid);
return 0;
}
织梦狗教程
本文标题为:C语言——typedef


基础教程推荐
猜你喜欢
- 带你深度走入C语言取整以及4种函数 2022-09-17
- [c语言-函数]不定量参数 2023-09-08
- 全面了解C语言 static 关键字 2023-03-26
- centos 7 vscode cmake 编译c++工程 2023-09-17
- [C语言]二叉搜索树 2023-09-07
- C++实战之二进制数据处理与封装 2023-05-29
- C语言编程C++旋转字符操作串示例详解 2022-11-20
- C++实现ETW进行进程变动监控详解 2023-05-15
- C语言实现宾馆管理系统课程设计 2023-03-13
- C语言 详解字符串基础 2023-03-27