

MCQOPTIONS
Saved Bookmarks
1. |
Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?_x000D_ #include_x000D_ #include_x000D_ _x000D_ int main()_x000D_ {_x000D_ struct ex_x000D_ {_x000D_ int i;_x000D_ float j;_x000D_ char *s_x000D_ };_x000D_ struct ex *p;_x000D_ p = (struct ex *)malloc(sizeof(struct ex));_x000D_ p->s = (char*)malloc(20);_x000D_ return 0;_x000D_ } |
A. | free(p); , free(p->s); |
B. | free(p->s); , free(p); |
C. | free(p->s); |
D. | free(p); |
Answer» C. free(p->s); | |