I'm a C++ beginner, currently studying stacks, with a basic knowledge of both C and C++. I am using Code::Blocks as my IDE with the MingW compiler that comes along. I have a question regarding the operators >> and <<.
What would happen if both the operands are streams?
say something like:
1 2 3 4 5 6 7 8 9 10
|
0 #include<iostream>
1
2 using namespace std;
3
4 int main()
5 {
6 cout << cin;
7 cin >> cout;
8 return 0;
9 }
| |
The code of line 4 compiles fine, and executes too, giving me the answer:
[code]
F:\College>test
0x445468
F:\College>
[\code]
Whereas line 5 gives me an error stating ambigous overload for operator>>.
Further, I tried a simple variation: I changed 'cin' in line 4 to '&cin'. The resulting execution gave me a slightly different answer: 0x445460
Could anyone explain to me:
a) the significance of 0x445468?
b) why line 4 doesn't generate an error?
c) why line 5 does?
d) why changing cin to &cin decreased the output by 8?