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

Can we run c program in turbo c++?

678


If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?

743


How are the features of c++ different from c?

689


What is static class data?

656


List different attributes in C++?

731






Are vectors faster than arrays?

652


Explain terminate() function?

677


Is it possible to have a recursive inline function in c++?

657


What does the ios::ate argument do?

772


What is the difference between structures and unions?

676


What are compilers in c++?

700


What are the two types of polymorphism?

682


Explain rtti.

669


How do you sort a sort function in c++ to sort in descending order?

670


Why do we use pointers in c++?

677