typedef
/*
typedef
1.用一个新的类型名代替原来的类型名
typedef int integer;
typedef float real;
int i,j;float a,b; 与 integer i,j; real a,b;等价
2.命名一个简单的类型名代替复杂的类型表示方法
(1)命名一个新的类型名代表结构体类型
typedef struct
{int month;int day;int year;}Date;
Date birthday;
Date *p
(2)命名一个新的类型名代表数组类型
typedef int num[100];
num a;
(3)命名一个新的类型名代表一个指针类型
typedef char *string;
string p,s[10];
(4)命名一个新的类型名代表指向函数的指针类型
typedef int(*pointer)();
pointer p1,p2;
总结:声明新的类型名的方法:
1先按定义变量的方法写出定义体(int i;)
2将变量名换成新类型名(将i换成count)
3在最前面加typedef
typedef int count
4用新类型名去定义变量
Ⅰ.以定义数组类型为例:
int a[100];
int num[100];
typedef int num[100];
num a;
int a[100];
Ⅱ.字符指针类型:
char *p;
char *string;
typedef char *string;
string p;等价char *p;
*/
#include <stdio.h>
typedef int intjie;
int main()
{
int x = 90;
intjie y = 100;
printf("\nx=%d\n\n", x)