Open In App

C Quiz – 109 | Question 5

Like Article
Like
Save
Share
Report

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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Similar Reads