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

what will be the output of this above code?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is time h in c++?

837


Define stacks. Provide an example where they are useful.

755


How do we balance an AVL Tree in C++?

836


What is a hash function c++?

744


What is a local variable?

790






Tell me what are static member functions?

775


Which c++ compiler is best?

814


What is a tuple c++?

727


Why is c++ awesome?

785


How to declare an array of pointers to integer?

784


Can you explicitly call a destructor on a local variable?

773


Why is c++ still used?

782


What is #include sstream?

789


What is a rooted hierarchy?

861


I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

2508