title: Any benefit of using assert instead of using a simple "if" ?
body: <p>Given this code : </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;assert.h&gt;
  
  void print_number(int* somePtr) {
    assert (somePtr!=NULL);
    printf ("%d\n",*somePtr);
  }
  
  int main ()
  {
    int a=1234;
    int * b = NULL;
    int * c = NULL;
  
    b=&amp;a;
  
    print_number (c);
    print_number (b);
  
    return 0;
  }
  </code></pre>
  
  <p>I can do this instead : </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;assert.h&gt;
  
  void print_number(int* somePtr) {
    if (somePtr != NULL)
         printf ("%d\n",*somePtr);
    // else do something 
  }
  
  int main ()
  {
    int a=1234;
    int * b = NULL;
    int * c = NULL;
  
    b=&amp;a;
  
    print_number (c);
    print_number (b);
  
    return 0;
  }
  </code></pre>
  
  <p>So , what am I gaining by using assert ? </p>
  
  <p>Regards </p>