结构体的声明
一、
struct point//声明结构名为point
{
int x;
int y;
};
struct point p1,p2;//p1,p2为结构的两个变量
//赋值
p1.x=1;
p2.y=2;
二、
struct
{
int x;
int y;
}p1,p2;//无名结构
三、
struct point
{
int x;
int y;
}p1,p2;
实例
无返回类型
#include <stdio.h>
struct point
{
int x;
int y;
};
void getStruct(struct point);
void output(struct point);
int main()
{
struct point y={
0, 0};
getStruct