C语言共用体的问题?
程序代码:
#include<stdio.h> struct student { int num; char name[20]; char sex; int age; }stu[3]={{10101,"LiLin","M",18}, {10102,"ZhangFun","M",19}, {{10101,"LiLin","F",20}}; main() { struct student*p; for(p=stu;p<stu+3;p++) printf("%d%s%c%d\n",P->num,P->name,P->sex,P->age); }stu[3]={{10101,"LiLin","M",18},
{10102,"ZhangFun","M",19},
{{10101,"LiLin","F",20}}; 一直在编译器显示非法初始化,我用的编译器win-tc.