C Quiz – 109 | Question 4
Find out the correct statement for the following program.
#include "stdio.h" int * gPtr; int main() { int * lPtr = NULL; if(gPtr == lPtr) { printf("Equal!"); } else { printf("Not Equal"); } return 0; } |
chevron_right
filter_none
(A) It’ll always print Equal.
(B) It’ll always print Not Equal.
(C) Since gPtr isn’t initialized in the program, it’ll print sometimes Equal and at other times Not Equal.
Answer: (A)
Explanation: It should be noted that global variables such gPtr (which is a global pointer to int) are initialized to ZERO. That’s why gPtr (which is a global pointer and initialized implicitly) and lPtr (which a is local pointer and initialized explicitly) would have same value i.e. correct answer is a.
Quiz of this Question
Recommended Posts:
- C Quiz - 101 | Question 1
- C Quiz - 101 | Question 3
- C Quiz - 101 | Question 2
- C Quiz - 103 | Question 1
- C Quiz - 101 | Question 4
- C Quiz - 108 | Question 1
- C Quiz - 110 | Question 2
- C Quiz - 110 | Question 3
- C Quiz - 110 | Question 4
- C Quiz - 110 | Question 5
- C Quiz - 110 | Question 1
- C Quiz - 109 | Question 5
- C Quiz - 108 | Question 2
- C Quiz - 108 | Question 3
- C Quiz - 108 | Question 4



