C program to implement error handling

C program to implement error handling


#include <stdio.h>
#include <errno.h>

extern int errno ;

int main ()
{
  FILE * pFile;
  pFile = fopen ("unexist.ent","rb");
  if (pFile == NULL)
  {
    perror ("The following error occurred");
    printf( "Value of errno: %d\n", errno );
  }
  else
    fclose (pFile);
  return 0;
}
If file unexist.ent does not exit then it will produce following result:
The following error occurred: No such file or directory
Value of errno: 29