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

Point out the correct statement which correctly allocates memory dynamically for 2D array following program?

OpenStudy (anonymous):

#include<stdio.h> #include<stdlib.h> int main() { int *p, i, j; /* Add statement here */ for(i=0; i<3; i++) { for(j=0; j<4; j++) { p[i*4+j] = i; printf("%d", p[i*4+j]); } } return 0; }

OpenStudy (anonymous):

Ans:p = (int*) malloc(3*4*sizeof(int));

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!