一、结构体表示:
struct Books //Books:标签
{
char title[50]; //结构体属性
char author[50];
char subject[100];
int book_id;
} book; //book:结构变量
以上三个属性至少需要出现两个
二、
结构变量没有定义:
struct SIMPLE
{
int a;
char b;
double c;
};
//一次性定义多个结构变量
struct SIMPLE t1, t2[20], *t3;
三、
//也可以用typedef创建新类型
typedef struct
{
int a;
char b;
double c;
} Simple2;
//现在可以用Simple2作为类型声明新的结构体变量
Simple2 u1, u2[20], *u3;
四、访问结构体成员
struct Books
{
char title[50];
char author[50];
char subject[100];
int book_id;
} book;
int a;
a=book.book_id;