【5】#define与typedef,typedef struct

1 typedef和define具体的详细区别

2,C语言结构体初始化的四种方法

3,struct和typedef struct彻底明白了

4,

#include 
typedef struct student
{
	int a;
	int b;
	int c;
}XS;   //XS==struct student 所以定义变量可以是 XS t11; struct student t12; // t111==t12;

typedef struct 
{
	int a;
	int b;
	int c;
}XSS;

int main()
{
	XS t1={
		.a=2,
		.b=5,
		.c=18,	
			};
	struct student t2={
		.a=61,
		.b=63,
		.c=168,	
			};

	XSS t3={
		.a=5,
		.b=7,
		.c=198,	
			};
   printf("a=%5d  b=%5d  c=%5d \n",t1.a,t1.b,t1.c);
   printf("a=%5d  b=%5d  c=%5d \n",t2.a,t2.b,t2.c);	
   printf("a=%5d  b=%5d  c=%5d \n",t3.a,t3.b,t3.c);
   
   return 0;
}

 

运行的结果

【5】#define与typedef,typedef struct_第1张图片

 

你可能感兴趣的:(【5】#define与typedef,typedef struct)