C中的一个项目正在逼迫我.我没有太多的C知识,但我认为答案很简单.
struct s1 {
char *text;
int num;
};
struct s2 {
struct s1 vals[5];
int numbers;
};
Run Code Online (Sandbox Code Playgroud)
假设s2已经填充.如何从s1访问num?我假设我会做类似的事情
struct s2 temp;
//temp is populated somehow, doesn't matter in the case
printf("%d\n", temp.vals[0]->num);
Run Code Online (Sandbox Code Playgroud)
但那不起作用.有什么建议?