数据结构_P12
来源:互联网 发布:域名 cc 编辑:程序博客网 时间:2024/05/18 18:16
# include <stdio.h>/**链表预备知识: typedef给数据类型(int、char、struct Student...)再取一个名字,两个都能用*2016年6月9日13:35:54*/typedef struct Student stt2; //struct Student数据类型再定义一个新名字:stt; 注: Student不是一个类型,struct Student才是一个数据类型typedef struct Student{int sid;char name[100];char sex;} stt3; //也可以这样写int main(void){struct Student st;st.sid = 100;printf("%d\n", st.sid);stt2 st2;st2.sid = 30;printf("%d\n", st2.sid);stt3 st3;st3.sid = 20;printf("%d\n", st3.sid);return 0;}
P12_2:
# include <stdio.h>/**链表预备知识: typedef给数据类型(int、char、struct Student...)再取一个名字,两个都能用*2016年6月9日14:28:14*/typedef struct Student{int sid;char name[100];char sex;}* PST;//这样写PST就代表struct Student* 类型,指针int main(void){struct Student st;st.sid = 100;printf("%d\n", st.sid);PST pst = &st;pst->sid = 99;printf("%d\n", pst->sid);return 0;}
P12_3:
# include <stdio.h>/**链表预备知识: typedef给数据类型(int、char、struct Student...)再取一个名字,两个都能用*2016年6月9日14:47:45*/typedef struct Student{int sid;char name[100];char sex;} STU, *PSTU;//这样写PSTU就代表struct Student* 类型指针,STU代表struct Student类型。两个一起连着写更方便!int main(void){struct Student st;st.sid = 100;printf("%d\n", st.sid);STU st2;st2.sid = 90;printf("%d\n", st2.sid);PSTU pst = &st2;pst->sid = 99;printf("%d\n", pst->sid);return 0;}
0 0
- 数据结构_P12
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- 数据结构
- Java学习之JDBC
- hdu 1166 敌兵布阵
- 一念永恒 > 第八十六章 又来这套……
- linux input设备驱动分析
- 一念永恒 > 第八十五章 他是……第一?
- 数据结构_P12
- HDU2045 (递推)
- .chm格式的电子书打开是空白的解决办法
- Python 字典KeyError
- linux压缩(解压缩)命令详解
- Microsoft Office 2016 简体中文 Vol 版镜像下载
- 网络留言板1
- 【问题】 WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping
- 内部类