#include <iostream>
using namespace std;
int main(){
int x = 0x414243;
cout.write( (char*)&x, 1);
cout.write( ((char*)&x) + 1, 2);
}
The output is:
CBA
I don't understand what (char*)& is doing with x.
Looking at this ASCII table http://www.asciitable.com/, it seems to me write() is writing 141, 142, 143, in octal... in reverse!
How is char* managing to do this?