一:
使用结构的一个优点就是:可以使用简单的赋值语句在同类型的结构之间复制信息
first=second
first.x=second.x&&first.y=second.y
二:
structlist{
int a;
char c;
};(注意这个分号不能少)
structlist{
int a;
char c;
}list1,list2;(注意这个分号不能少)
structlist{
int a;
char c;
};
三:
typedefstruct list A;
那么你的A student; 就等同与 struct list student;当然你也可以在声明一个结构体的时候给它起别名,也是比较常用的一种形式:
typedefstruct list{
int a;
char c;
}A;
四:定义一个struct:
struct Data
{
int a;
int b;
int c;
};
定义一个typedef struct
typedef struct
{
int d;
int e;
int f;
}DATA;
区别:C++语言中没区别C语言中前一个使用:struct Data mydata,后一个DATA mydata就可以了。