title: C, function not getting called, prototype is there before main()
body: <p>This a HW assignment to copy a file and to check that contents are the same using system calls.</p>
  
  <p>I have a prototype after my include statements:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  //three includes to use open
  #include &lt;fcntl.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;unistd.h&gt; //system calls if sys/syscalls.h does not work
  //this give specific error code
  #include &lt;errno.h&gt;
  extern int errno;
  
  void check_same(char *argv1, char *argv2);
  </code></pre>
  
  <p>Then my main function:</p>
  
  <pre><code>int main(int argc, char* argv[]){
      //mimic fd[0] for read and fd[1] for write
      int fd0, fd1; 
      //return value from read greater than 0 is ok, 0 is EOF, &lt;0 is an error
      int num_bytes;
      //BUFSIZ is 4096 or can be set to 1024, etc but larger is more efficient (bytes)
      char buf[BUFSIZ]; //char *buf for read and write, tracks file pos.
  .
  .
  .
  /*function gets called after I copy the file and close the file descriptors*/
  if((close(fd1)) &lt;0){
          printf("Write file not closed\n");
          exit(1);
      }
  
  //compare 2 files for sameness
  //int same = 0;
  check_same(argv[1], argv[2]);
  
  return 0;
  }
  </code></pre>
  
  <p>Then the function definition:</p>
  
  <pre><code>void check_same(char *argv1, char *argv2){
      printf("in check_same\n");
      //to open files and count bytes read
      int f0, f1, count;
      //position in each file
      int pos1, pos2;
      //buffer size 1 to check each char
      char orig[1];
      char copy[1];
  .
  .
  .
  </code></pre>
  
  <p>The first <code>printf()</code> statement does not show on the console so I know it does not even get there.  </p>
  
  <p>I have tried changing return type to <code>int</code> but get the same result of a successful copy from file <code>argv[1]</code> to file <code>argv[2]</code> but function <code>check_same()</code> not getting called.  What else should I be checking?
  For a full reproducible sample, please see comments for a link.</p>