【发布时间】:2016-02-24 08:15:09
【问题描述】:
下面的代码将 current2 移动到离我要停止的位置太远的一个节点:
typedef struct s_coo
{
int x;
int y;
int z;
void *next;
} t_coo;
typedef struct s_env
{
void *mlx;
void *win;
t_coo **head;
} t_env;
int draw_map_y(t_env *e)
{
t_coo *current;
t_coo *current2;
current = *(e->head);
current2 = (*(e->head))->next;
while (current2->y == 0)
current2 = current2->next;
return (0);
}
所以我尝试在while循环中编写:
while ((*(*current2))->next->y == 0)
代替:
while (current2->y == 0)
但我收到错误“间接需要指针操作数”。谁能解释我并告诉我如何以正确的方式编写它?我对 C 很陌生。谢谢。
【问题讨论】:
-
while (current2->y == 0) 没问题,你还改了什么?
标签: c