title: two output values through pointer
body: <p>I had to write the following function, which returns two output values.</p>
  <p>In order to do so I used a pointer for the second output value of the quotient. However when I wanted to test it with an input it seemed to be crushing. The code is:</p>
  <pre class="lang-c prettyprint-override"><code>
  #include &lt;stdio.h&gt;
  
  int div( int n, int m, int *quotient)
  {
      int d = 0;
      
      while (n &gt;= m) {
          n = n - m;
          d++;
      }
      *quotient = d;
      
      return n;
  }   
  
  int main(void)
  {
      int *p;
      int rest;
      
      rest = div(7, 2, p); 
      printf(&quot;n - %i, d - %i&quot;, rest, p);
      
      return 0;
  }
  </code></pre>
  <p>would be happy to know how to fix it and why it happened at first place</p>
  <p>Thanks for your help</p>