#include <stdio.h>
struct person{
char *name;
int age;
float high;
};
int main()
{
struct person{
char *name;
int age;
};
struct person f={"father",51};
printf("father=%s,age=%d\n",f.name,f.age);
struct person m={"mother",50,160.0f};
printf("mather=%s,age=%d,high=%.1f\n",m.name,m.age,m.high);
return 0;
}
我定义的struct person m报错了,我初始化多了一个float,难道不能自动往上找,匹配到那个全局结构体么,很疑惑,求解答,谢谢! |
|