typedef的用法

typedef的用法:

两种用法:

第一种用法:

1 定义

Typedef struct student{

Int a;

Int b;

}stu;

 

2 声明

有两种方式: <1>stu a;

 <2>struct student a;

即此时这个stu就可以代表结构体变量,然后去声明结构体变量类型。

第二种用法:

1 定义:

Typedef struct {

Int a;

Int b;

}stu;

 

2 声明:

此时就只能直接声明stu a;

 

重中之重:

Typedef struct student{

Char name[20];

Struct student * next;

Struct student * prior;//在这里不能这么写:stu * prior;

}  stu;

 

 

 

posted @ 2017-05-07 16:22  freebirds  阅读(81)  评论(0)    收藏  举报