[ create a new paste ] login | about

Link: http://codepad.org/lerTWOih    [ raw code | output | fork ]

C++, pasted on Jul 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
static union{
unsigned short int AX;
unsigned char Hreg[2];
};

unsigned char& AL = Hreg[0];
unsigned char& AH = Hreg[1];

int main(){
using std::cout;
AX=0xabcd;
cout << hex;
cout << "AX=" << AX << " AH=" << (int)AH << " AL=" << (int)AL << '\n';

AH=0x12;
cout << "AX=" << AX << " AH=" << (int)AH << " AL=" << (int)AL << '\n';
}


Output:
1
2
AX=abcd AH=0 AL=0
AX=abcd AH=12 AL=0


Create a new paste based on this one


Comments: