in the end i want elt to point on some address
why i get
c(28) : error C2223: left of '->next' must point to struct/union
but when i change it to
it works fine,why i need these colsCode:(*p)->next->next;
Code:#include <stdio.h> #include <stdlib.h> typedef struct node { int value; struct node *next; }Node; void what1(Node ** p,int num); int main() { Node *p; p=(Node *)malloc(sizeof(Node)); p->value=1; p->next=(Node *)malloc(sizeof(Node)); p->next->value=2; what1(&p,0); free(p); return 0; } void what1(Node ** p,int num) { Node *elt; elt=(Node*)malloc(sizeof(Node)); elt->next=*p; elt->value=num; *p=elt; elt=*p->next->next; }