下向上運動的代碼當前第一個節點太遠,我想停下來:指點反引用(間接需要指針操作數)
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)是好的,你還有什麼改變? – 4pie0