Logo 
Search:

C++ Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C++ ProgrammingRSS Feeds

What is the output of the below code?

  Shared By: Mina Schmidt    Date: Dec 06    Category: C++ Programming    Views: 2278

Answer:

Consider the following code segment:
int main()
{
int x, *x_ptr=&x;
x=5;
x_ptr=NULL;
cout<< x << “ “ << *x_ptr;
return 0;
}

What is the output of the above code?

Options

a) <hexadecimal address> 0
b) <hexadecimal address> <hexadecimal address> but addresses are same
c) <hexadecimal address> <hexadecimal address> but having different addresses
d) <hexadecimal address> 5

Answer : a) <hexadecimal address> 0

Share: 
 

Didn't find what you were looking for? Find more on What is the output of the below code? Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: