본문 바로가기

카테고리 없음

struct and reinterpret_cast operator

#include "stdafx.h"

#include <iostream>

#include <string>


struct Int {

int num;


};


int main()

{

using namespace std;


int num = 5;

Int Num;


Num = *reinterpret_cast<Int *>(&num);


cout << Num.num << endl;

return 0;

}