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 would you use qsort() function to sort an array of structures?

0 Answers  


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

0 Answers  


What is virtual function? Explain with an example

0 Answers  


There is a array of 99 cells and we have to enter 1-100 elements in it , no two elements would repeat , so the is one no. missing because 99 cells and 1-100 nos. so we had to implement a function to find that missing no.

2 Answers   Nagarro,


Why use of template is better than a base class?

0 Answers  






What is a base class?

0 Answers  


What is polymorphism in c++? Explain with an example?

0 Answers  


Difference between a copy constructor and an assignment operator.

0 Answers  


Define macro.

0 Answers  


Is c++ still being used?

0 Answers  


Why do we use setw in c++?

0 Answers  


What is a dangling pointer?

3 Answers   Glenwood,


Categories