c语言结构体

定义结构方法一:


struct temp{

int x;

int y;

};

void main(){

struct temp t;

t.x = 100;

t.y = 10;


printf("%d", t.x);

}


定义方法二:


typedef struct{

int x;

int y;

} temp;


void main(){

temp t;

t.x = 100;

t.y = 10;


printf("%d", t.x);

}


方法二和方法一的区别在于定义时是否带struc.

原文地址:https://www.cnblogs.com/itfenqing/p/4429466.html