int main()
{
int *p=new int;
*p=10;
del p;
cout<<*p;
*p= 60;
cout<<*p;
}
what will be the output & why?

Answer Posted / sethuu

First output will print some garbage value because you
delete the object p and the you print.

The second one will print value 60.

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is using exit() the same as using return?

682


For what purpose null pointer used?

609


What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

735


What does c mean in standard form?

601


What does void main () mean?

738






Difference between malloc() and calloc() function?

657


What's the difference between constant char *p and char * constant p?

660


What is the difference between union and anonymous union?

839


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

651


What are actual arguments?

649


What is the purpose of sprintf?

625


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

636


Is null valid for pointers to functions?

616


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

907


Why cant I open a file by its explicit path?

595