• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

C Quiz - 101 | Question 3

C
#include \"stdlib.h\"
int main()
{
 int *pInt;
 int **ppInt1;
 int **ppInt2;

 pInt = (int*)malloc(sizeof(int));
 ppInt1 = (int**)malloc(10*sizeof(int*));
 ppInt2 = (int**)malloc(10*sizeof(int*));

 free(pInt);
 free(ppInt1);
 free(*ppInt2);
 return 0;
}
Choose the correct statement w.r.t. above C program.

(A)

malloc() for ppInt1 and ppInt2 isn’t correct. It’ll give compile time error.

(B)

free(*ppInt2) is not correct. It’ll give compile time error.

(C)

free(*ppInt2) is not correct. It’ll give run time error.

(D)

No issue with any of the malloc() and free() i.e. no compile/run time error.

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments