[ create a new paste ] login | about

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

C++, pasted on Dec 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>

int main()
{
	// wchar_tのサイズってもしかして環境依存??
	// byte配列にaddのポインタを設定、byteとして取り出す
	wchar_t add = L'1' + L'2';
	unsigned char *data = (unsigned char*)&add;

	// いざ、表示!
	printf("0x%02hx 0x%02hx\n", (short)data[0], (short)data[1]);
	return 0;
}


Output:
1
0x63 0x00


Create a new paste based on this one


Comments: