title: What happens in OS when we dereference a NULL pointer in C?
body: <p>Let's say there is a pointer and we initialize it with NULL.</p>
  
  <pre><code>int* ptr = NULL;
  *ptr = 10;
  </code></pre>
  
  <p>Now , the program will crash since <code>ptr</code> isn't pointing to any address and we're assigning a value to that , which is an invalid access. So , the question is , what happens internally in the OS ? Does a page-fault / segmentation-fault occur ? Will the kernel even search in the page table ? Or the crash occur before that?</p>
  
  <p>I know I wouldn't do such a thing in any program but this is just to know what happens internally in the OS or Compiler in such a case. And it is NOT a duplicate question.</p>