c中的结构声明
Structure decclaration in c
#include<stdio.h>
struct parent{
int a;
int b;
struct child{
char*c ;
} c = {"child"};
} p = {1,2};
void main()
{}
为什么上面的代码会导致编译错误?
写成如下代码
struct parent{
int a;
int b;
struct child{
char*c ;
} c;
} p = {1,2, {"child"}};
#include<stdio.h>
struct parent{
int a;
int b;
struct child{
char*c ;
} c = {"child"};
} p = {1,2};
void main()
{}
为什么上面的代码会导致编译错误?
写成如下代码
struct parent{
int a;
int b;
struct child{
char*c ;
} c;
} p = {1,2, {"child"}};