Null reference for first memory address between 0 - 65535
I would like to understand a bit more about memory and I was unable to find it from Google, please forgive me if this is silly question.
How come the following code, accessing memory address 0(and up to 65535) in C# would throw NullReferenceException
b开发者_开发百科yte* pointer = (byte*)0;
byte test = *pointer;
Thanks a lot in advance!
This is a design feature of Windows itself. In order to catch programmer mistakes early in the development cycle, the virtual addresses from 0 to 64K (- 1) are invalid in all processes.
精彩评论