#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
typedef struct mini1{
int a;
int b;
} MAX;
typedef struct mini2{
MAX max1;
MAX max2;
}MAX2;
// static MAX2 PRO={
// .max1={1,2},
// .max2={3,4},
// };
static MAX2 PRO;
PRO.max1={1,2};//这边这么定义为什么编译不了
// PRO.max2={3,4};
// printf("%d",PRO.max1.a);
// printf("%d",PRO.max2.a);//这边要想调用a,为什么需要加上PRO.,直接max2.a为什么没有办法调用。
return 0;
}
1.问题1
PRO.max1={1,2};//为什么这么定义有问题,应该怎么去赋值max1。
2.这样赋值是成功了,为什么,不理解,可能在深入学习指针就理解了。可能结构嵌套,就是需要这么来定义。
static MAX2 PRO={
.max1={1,2},
.max2={3,4}
}