[英]Assign place in struct to variable (or pointer)
我的结构看起来像这样:
struct Node
{
int value;
struct Node *children[26];
};
typedef struct Node *List;
我想将第一个(主)结构分配给变量(或指针),这样我可以回到它(移至“子结构”之后)。 即
start = malloc(sizeof(struct Node));
(this variable) = start;
list = (this variable);
list = list -> children[25];
...
list = (this variable) //We're again in main/first struct.
所以…。 你为什么不能说:
List start = malloc(whatever);
List list = start;
list = list->children[25]; // index 26 is out of bounds…
您不确定是否可以声明List类型的问题吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.