Skip to content
Related Articles

Related Articles

Improve Article

C Quiz – 109 | Question 5

  • Difficulty Level : Basic
  • Last Updated : 28 Jun, 2021

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

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.
My Personal Notes arrow_drop_up
Recommended Articles
Page :