title: C - initialized pointer throws exception about nullptr
body: <p>I have a code that intends to find minimal value using pointers, using a function.
  The problem is that even though I initialize the pointer while debugging it shows:</p>
  
  <blockquote>
    <p>Exception thrown: read access violation.
    min was nullptr.</p>
  </blockquote>
  
  <p>At line 37. The code can be seen below:</p>
  
  <pre><code>#define _CRT_SECURE_NO_WARNINGS
  #include "stdio.h"
  
  int tab_min(const int* tab, int size, int *min);
  
  int main()
  {
      int limit;
      int tab[100];
      int * ptab = tab;
      int min = 2;
      int *pmin = &amp;min;
  
      printf("Number of elements: ");
      scanf("%d", &amp;limit);
      printf("List the elements \n");
      for (int i = 0; i &lt; limit; i++)
      {
          scanf("%d", &amp;*(ptab + i)); 
      }
      tab_min(ptab, limit, pmin);
  
      return 0;
  }
  
  int tab_min(const int* tab, int size, int *min) 
  {
  
      if ((tab == NULL) || (size &lt;= 0) || (min = NULL)) 
      {
          return 0; 
      }
      else 
      {
          for (int i = 0; i &lt; size; i++)
          {
              if (*(tab + i) &lt; *min) *min = *(tab + i); //Exception is here
          }
      return 0;
      }
  }
  </code></pre>
  
  <p>Can somebody please explain to me what is wrong with my reasoning?</p>