why the above code gives the error and i cant help it while the code is correct logically. pls help soooooooon!Code:#include <stdio.h> #include <stdlib.h> struct a { int a; char c; }; main() { struct a *p, q; void func(struct a **); printf("Previous address p: %u",p); func(&p); printf("\nNew address p: %u",p); printf("\nValues stored in p: %d %c\n",p->a,p->c); } void func(struct a **ptr) { *ptr=(struct a *)malloc(sizeof(struct a)); printf("\n*********%u",*ptr); *ptr->a=100; *ptr->c='f'; /*try reducing and addind the *s */ }


LinkBack URL
About LinkBacks






Reply With Quote

