Sail E0 Webinar
Question


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


#include<stdio.h>
#include<stdlib.h>
int main()
{
int *p, i, j;
/* Add statement here */
for(i=0; i
Options:
A .  p = (int*) malloc(3, 4);
B .  p = (int*) malloc(3*sizeof(int));
C .  p = malloc(3*4*sizeof(int));
D .  p = (int*) malloc(3*4*sizeof(int));
Answer: Option D



Submit Your Solution Below and Earn Points !

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers