Please open the menu to show more

Friday, July 21, 2017

Very frequently asked interview question on c++

What is the output of given program of c++ programming language



#include<iostream.h>
int main()
{
cout<<cout; // address of cout printed

cout<<cin; // address of cin printed
     
          return 0;
}


- lets look inside this code 

- cout is an object of ostream class which is used to display the data on standard output (means the console)
- cin is an object of istream class which is used to get input from standard input (means using keyboard from console)
- in computer science the object is a memory allocated during runtime (means during program execution), and we know every memory has an unique address 
- so in this case the address of cout and cin will be printed 

No comments:

Post a Comment