title: error: invalid type argument of unary ‘*’ (have ‘int’)
body: <p>I am trying to pass error to main function using pass by reference, but when I compile the below code I get an error as</p>
  
  <p><strong>error: invalid type argument of unary ‘*’ (have ‘int’)</strong></p>
  
  <p><strong>Main code :</strong></p>
  
  <pre><code>main()
  {
  .
  .
  int error=-1;
  foo(..., error);
  .
  .
  }
  </code></pre>
  
  <p><strong>Function Code:</strong></p>
  
  <pre><code>foo(..., int &amp;error)
  {
      if ( ...)
          *error = errno;
  }
  </code></pre>
  
  <p>errno is the standard error set from system call in linux.</p>
  
  <p>The  header file defines the integer variable errno, which is set by system calls and some library functions in the event of an error to indicate what went wrong.</p>