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