title: Pass stream by reference
body: <p>I am suppose to pass stream, which is a pointer, by reference. So I am passing this as a pointer to a pointer. Can someone please verify my code?</p>
  
  <pre><code>    int main(int argc, char** argv)
  {
      FILE *stream;
  
      printf("LINES: %d\n",scan(stream));
  }
  
  int scan(FILE *(*stream))
  {
      stream = fopen("names.txt", "r");
  
      int ch = 0, lines=0;
  
      while (!feof(*stream))
      {
          ch = fgetc(*stream);
          if (ch == '\n')
          {
              lines++;
          }
      }
      fclose(*stream);
      return lines;
  }
  </code></pre>
  
  <p>No output received.</p>