std::cout << (DWORD)"test";
If I compile and run this I get different output values each time, but I can’t figure out why.
Any ideas?
PS: I’m using Windows 7 64-bit and I’m compiling with Microsoft Visual C++ 2010 Ultimate.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
“test”, in your code, is effectively a pointer to the start of the string. When you cast it to a
DWORD, your casting the pointer to an integer type, and writing out that number.As the memory location which is storing “test” can change with each run, the value you see will change.