Zero reference for the first memory address from 0 to 65535

I would like to know a little more about memory, and I could not find it from Google, please forgive me if this is a stupid question.

How is it that the following code, referring to memory address 0 (and up to 65535) in C #, will throw a NullReferenceException

byte * pointer = (byte *) 0;

byte test = * pointer;

Many thanks!

+3
source share
1 answer

This is a design feature of Windows itself. In order to catch the programmer’s errors at the beginning of the development cycle, virtual addresses from 0 to 64K (-1) are invalid in all processes.

+3
source

Source: https://habr.com/ru/post/1745991/


All Articles