struct 包 struct 的 pointer會有問題 煩請幫忙
struct gogo
{
int ok;
};
struct go
{
int num;
char * name;
struct gogo *gogo2;
};
int main()
{
struct go chu;
chu.num = 20;
chu.name = "cool";
chu.gogo2->ok = 99999;
printf("num %d \n",chu.num);
printf("name %s \n",chu.name);
printf("gogo2 num is %d\n",chu.gogo2->ok);
}
會有Segmentation fault 錯誤 煩請各位幫忙 謝謝