«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Archives
관리 메뉴

printf("ho_tari\n");

Pointer3 (reinterpret_cast) 본문

C++

Pointer3 (reinterpret_cast)

호타리 2023. 9. 8. 16:56
#include <stdio.h>



int main(void)

{

	int a = 0x12345678;

	//int *p;

	char *p;

	

	//p = static_cast<char*>(&a);

	p = reinterpret_cast<char *>(&a);

	

	printf("*p : 0x%x\n", *p);

	

	return 0;

}

 

<compile 결과>

'C++' 카테고리의 다른 글

String4 (const_cast)  (0) 2023.09.08
Shape (dynamic_cast)  (0) 2023.09.08
GenderRatio (static_cast)  (0) 2023.09.08
SafeArray4 (try, throw, catch)  (0) 2023.09.08
BoundArray2 (template 사용)  (0) 2023.09.08