Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?

OpenStudy (anonymous):

#include<stdio.h> #include<stdlib.h> int main() { struct ex { int i; float j; char *s }; struct ex *p; p = (struct ex *)malloc(sizeof(struct ex)); p->s = (char*)malloc(20); return 0; }

OpenStudy (anonymous):

free(p->s); , free(p);

OpenStudy (anonymous):

Thanks

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!