access violation casting to void* and back
问题 I get an access violation reading location when I try the following. What am I doing wrong? uint64_t hInt = 2901924954136; void* hPoint = reinterpret_cast<void*>(hInt); uint64_t hIntBack = *static_cast<uint64_t*>(hPoint); //get access violation here 回答1: I am guessing you meant to store the address of hInt in hPoint , not the value of hInt . uint64_t hInt = 2901924954136; void* hPoint = reinterpret_cast<void*>(&hInt); // ^ addressof operator 回答2: What you do is the following: cast an integer