Open In App

C Quiz – 109 | Question 5

Find out the correct statement for the following program.




#include "stdio.h"
  
int * arrPtr[5];
  
int main()
{
 if(*(arrPtr+2) == *(arrPtr+4))
 {
   printf("Equal!");
 }
 else
 {
  printf("Not Equal");
 }
 return 0;
}

(A) Compile Error
(B) It’ll always print Equal.
(C) It’ll always print Not Equal.
(D) Since elements of arrPtr aren’t initialized in the program, it’ll print either Equal or Not Equal.

Answer: (B)
Explanation: Here arrPtr is a global array of pointers to int. It should be noted that global variables such arrPtr are initialized to ZERO. That’s why all are elements of arrPtr are initialized implicitly to ZERO i.e. correct answer is b.
Quiz of this Question

Article Tags :