title: How Do I Move my printf statement to my main driver?
body: <p>This might be a dumb question but how do I move my <code>printf</code> statement from my <code>readfile</code> function to my <code>main</code> function while keeping my <code>if</code> statement intact? I kind of want to put a <code>return</code> there but I'm not to sure. Here's my code.</p>
  <pre class="lang-c prettyprint-override"><code>int readfile( struct record somearray[ ], int *num, char filename[ ] )
  {
      FILE *fptr;
      int count=0;
      char str_read[1000];
      fptr = fopen(filename , &quot;r&quot;);
  
      if (fptr == NULL)
      {
          fprintf(stderr, &quot;\nError opening file\n&quot;);
          return 1;
      }
      while(fgets(str_read, sizeof(str_read) , fptr)!= NULL)
      {
          if((sscanf(str_read, &quot;%d&quot;, &amp;somearray-&gt;level)!=1) &amp;&amp; (sscanf(str_read, &quot;%s&quot;, pokesomearray-&gt;name)))
          {
              printf(&quot;level: %d\n name: %s\n&quot;, somearray-&gt;level, somearray-&gt;name);      
          }
          *num = ((count++)+1)/2;        
      }
          printf(&quot;The count is: %d\n&quot;, *num);
      fclose(fptr);
      return 0;
  }
  </code></pre>
  <p>here my main function</p>
  <pre><code>int readfile( struct record somearray[ ], int *num, char filename[ ] );
  
  int main(int argc, char *argv[])
  {
      int num;
      char filename[]= &quot;test_file.txt&quot;;
      struct record bank[5];
      int status_read = readfile( bank, &amp;num, filename);
  
      if ( status_read != 0 )
      {
          printf(&quot;ERROR: Unable to read file&quot;);
          return 0;
      }
      else
      {
          printf(&quot;Reading Accounts Successful\n\n&quot;);
          printf(&quot;level: %d\n&quot;, bank-&gt;level);
      }
  
  
    return 0;
  }
  </code></pre>