struct node{
int data;
struct node *next;
};
main(){
struct node a,b,c,d;
struct node *s=&a;
a={10,&b};
b={10,&c};
c={10,&d};
d={10,NULL};
do{
printf("%d %d",(*s).data,(*s).next);
s=*s.next;
}while(*s.next!=NULL);
}
It is showing error at a={10,&b};Expression syntex error.please help.. thankzz in advance
Initialize the variable immediately:
struct node a={10,NULL};
And then assign the address:
a.next = &b;
Or use a compound literal:
a=( struct node ){10,&b}; //must be using at least C99
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments