26.typedef和#define

#include <stdio.h>  //fopen函数的包
#include <stdlib.h> //exit()函数的包
#include <string.h>

//typedef为数据类型搞一个别名,规范这个别名通常会用大写
typedef char * STRING;

//用define来为类型创建别名
#define STRING1 char *

typedef struct { char *name; int age; } Person;


int main()
{

STRING name = "大王";

STRING1 name1 = "叫我来巡山";

printf("%s====%s\n", name, name1);

Person p = { .name = "gaocun", .age = 23 };

printf("%s\n", p.name );

return 0;
}

 

上一篇:[POJ3761]Bubble Sort


下一篇:C. Maximize the Intersections