[Solved] What’s wrong with this code which prints the value at address obtained after converting an integer to an integer pointer [closed]
*((int*)2000) is not “perfectly valid code”. The result of converting an integer to a pointer is implementation-defined. It’s likely that in your implementation, (int*)2000 results in an invalid pointer. Trying to dereference an invalid pointer produces undefined behavior, which means that anything can happen. When you ran the program with the printf line uncommented, it … Read more