结构体的形式如下:
struct fish
{
const char *name;
const char *special;
int teeth;
};
在结构体中还能嵌套结构体
<pre name="code" class="cpp">struct preferences{
const char *food;
float exercise_hours;
};
struct fish{
const char *name;
const char *special;
int teeth;
struct preferences care;
};
struct fish tony = {"tony","piranha",15,{"meat",7.5}};