int *p = NULL;
printf("%1d",p) ;

what will be the output of this above code?

Answers were Sorted based on User's Feedback



int *p = NULL; printf("%1d",p) ; what will be the output of this above code?..

Answer / vasanth

Ans : 0

Since the pointer is having NULL Address,when we try to
print like printf("%1d",*p) it will be giving the exception
hence windows will not accept NULL pointer.

Use cout<<p; then we can print NULL address 0x00000000

Note: the ans is based on VC++ compiler.

Is This Answer Correct ?    18 Yes 0 No

int *p = NULL; printf("%1d",p) ; what will be the output of this above code?..

Answer / sourisengupta

0

Is This Answer Correct ?    5 Yes 0 No

int *p = NULL; printf("%1d",p) ; what will be the output of this above code?..

Answer / ravi

undefined

Is This Answer Correct ?    0 Yes 13 No

Post New Answer

More C++ General Interview Questions

How the programmer of a class should decide whether to declare member function or a friend function?

0 Answers  


Write is a binary search tree? Write an algo and tell complexity?

0 Answers   Axtria,


Write a short code using c++ to print out all odd number from 1 to 100 using a for loop

0 Answers  


Why do we use using namespace std in c++?

0 Answers  


What are the static members and static member functions?

1 Answers  


What are function prototypes?

0 Answers  


how many trys can we write in one class

3 Answers   Cap Gemini,


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

0 Answers  


What are move semantics?

0 Answers  


Is there a new/delete equivalent of realloc?

1 Answers  


Why is c++ a mid-level programming language?

0 Answers  


Can you think of a situation where your program would crash without reaching the breakball, which you set at the beginning of main()?

1 Answers  


Categories