1 1 vote #include "stdio.h" int * gPtr; int main() { int * lPtr = NULL; if(gPtr == lPtr) { printf("Equal!"); } else { printf("Not Equal"); } return 0; } what will be the outpout : A.> it will always print equal B> it will always print Not equal C>Since gPtr isn’t initialized in the program, it’ll print sometimes Equal and at other times Not Equal. Programming in C + – bharti 2.4k views answer comment Share Follow Print See all 11 Comments 11 11 Comments reply Show 8 previous comments bharti commented Aug 24, 2017 i reshown by bharti Aug 25, 2017 reply Follow flag @saxena0612 yeah ! I did :) Thank you 0 0 replyShare Hemant Parihar commented Aug 25, 2017 reply Follow flag @saxena0612 Any resources for your this statement. "when you point pointer to NULL then it means that it is pointing to the memory address 0x0." (Always) 0 0 replyShare saxena0612 commented Aug 25, 2017 reply Follow flag According to C Standard Document section 6.3.2.3: An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.55) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function. 1 1 replyShare Please log in or register to add a comment.
0 0 votes Ans is A. Global variables (pointers or data members) are always assigned a default value at compilation. Hence the default value for gPtr is NULL. Abbas2131 answered Aug 24, 2017 Abbas2131 comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Global variables are by default NULL and the ASCII value of NULL is 0.So 0=0 is true hence output would be EQUAL! sandeepjkh answered Aug 25, 2017 sandeepjkh comment Share Follow 0 reply Please log in or register to add a comment.