title: Passing array into function in c
body: <p>I'm getting gcc errors when I compile my code. The errors are about &quot;passing argument 1 of ‘print_path’ makes pointer from integer without a cast&quot;.</p>
  <p>Here is my function prototype:</p>
  <pre><code>void print_path(int previous[], int desired_node_index);
  </code></pre>
  <p>Here is my function:</p>
  <pre><code>void print_path(int previous[], int desired_node_index)
  {
      if( previous[desired_node_index] != -1 )
          print_path( previous[desired_node_index] );
      printf(&quot;-&gt; %d &quot;, previous[desired_node_index]);
  }
  </code></pre>
  <p>and here is where I call my function:</p>
  <pre><code>print_path(previous, dest_index);
  </code></pre>
  <p>I'm obviously passing it in wrong, or else I'm doing something incorrectly about how to pass an array into a function. Any help?</p>
  <p>Thanks guys!</p>