Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (eamier):

i do not what is happening in this c program. please explain

OpenStudy (eamier):

//cellinst.c #include<stdio.h> struct llist{ //struct is used to group data. int x,y; //this is the member of the struct. struct llist *next; //struct member that also struct. here the trick }; //this struct is used without typedef, so need to repeat "struct" word each time to mention struct llist *newcell(int x, int y) //declaring struct with "struct" word. { struct llist *pt; pt = (struct llist *) malloc(sizeof(struct llist)); // pt->x=x; pt->y=y; // -> is used to refer to the variable of another function in this case of a struct return(pt); } main() { struct llist *top, *p, *q; p = newcell(1,1); top = p; q = p; p = newcell(3,9); q->next = p; p-> next = NULL; p = newcell(2,4); p->next = top->next; top->next = p; q = top; do { printf("%d %d\n", q->x, q->y); q = q->next; }while (q != NULL); }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!