C Programming :: Memory Allocation
-
Which of the following statement is correct prototype of the malloc() function in c ?
-
Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?
#include
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; } -
Point out the correct statement which correctly allocates memory dynamically for 2D array following program?
#include
int main() { int *p, i, j; /* Add statement here */ for(i=0; i3; i++) { for(j=0; j4; j++) { p[i*4+j] = i; printf("%d", p[i*4+j]); } } return 0; }