title: Passing a parameter in a callback in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/840501/how-do-function-pointers-in-c-work">How do function pointers in C work?</a>  </p>
  </blockquote>
  
  
  
  <p>Surfing on <a href="https://stackoverflow.com/questions/142789/what-is-a-callback-in-c-and-how-are-they-implemented">stackoverflow</a> I found this example:</p>
  
  <pre><code>/* Validation functions start */
  void populate_array(int *array, size_t arraySize, int (*getNextValue)(void))
  {
      for (size_t i=0; i&lt;arraySize; i++)
          array[i] = getNextValue();
  }
  
  int getNextRandomValue(void)
  {
      return rand();
  }
  
  int main(void)
  {
      int myarray[10];
      populate_array(myarray, 10, getNextRandomValue);
      ...
  }
  </code></pre>
  
  <p>I was wondering, imagine getNextRandomValue had a parameter getNextRandomValue(int i), how would I include this and making the function accepting inputs?</p>
  
  <p>Many thanks</p>