title: Printing random array element in C89
body: <p>I have the following code that works fine:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;/*need this for rand()*/
  #include "random.h"
  #include &lt;time.h&gt;/*for time() function*/
  
  int main()
  {
      int arr[5], a = 0;
      printf("enter 5 array elements\n");
      scanf("%d", &amp;arr[0]);
      scanf("%d", &amp;arr[1]); 
      scanf("%d", &amp;arr[2]); 
      scanf("%d", &amp;arr[3]); 
      scanf("%d", &amp;arr[4]); /*scan all elements*/
      srand(time(NULL)); /*set the seed*/
      a = arr[rand() % ARR_SIZE(arr)];/*from .h file*/
      printf("%d\n",a);/*print the random element generated above*/
      return 0;
  }
  </code></pre>
  
  <p>It picks a random integer for an array of 5 integers.</p>
  
  <p>I need the following modifications to it:</p>
  
  <p>A function should accept two parameters — an array of void pointers and the array length. It should return a void pointer.</p>
  
  <p>The function should pick an element from the array at random and return it.</p>
  
  <p>int main() must seed the random number generator and then call the function. Then finally it should print the random element that was generated.</p>
  
  <p>I don't know how to modify it to meet above requirements.</p>
  
  <p>Here are the random.h file contents:</p>
  
  <pre><code>#define ARR_SIZE(arr) ( sizeof((arr)) / sizeof((arr[0])) )
  </code></pre>