1. What does the following do:

void afunction(int *x)
{
x=new int;
*x=12;
}
int main()
{
int v=10;
afunction(&v);
cout<<v;
}
a) Outputs 12
b) Outputs 10
c) Outputs the address of v

Answer Posted / manish podiyal

C): outputs the address of v.

Is This Answer Correct ?    1 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of c++ over c?

808


What are the advantages of using const reference arguments in a function?

828


Where Malloc(), Calloc(), and realloc() does get memory?

807


Should I learn c or c++ or c#?

748


What is the difference between interpreters and compilers?

837


Is c++ proprietary?

795


What is diamond problem in c++?

753


You run a shell on unix system. How would you tell which shell are you running?

884


What is a far pointer? where we use it?

801


What do nonglobal variables default to a) auto b) register c) static

879


Which is better turbo c++ or dev c++?

752


Out of fgets() and gets() which function is safe to use and why?

926


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

820


How many ways can a variable be initialized into in C++?

776


How to implement is-a and has-a class relationships?

772