C Quiz – 109 | Question 5

Find out the correct statement for the following program.

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


(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

GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.