Stderr
Stderr is another example of a stream.
Just like stdin and stdout, it is predefined and does not have to be explicitly opened by the programmer.
Stderr is used for error messages. These messages are displayed on the screen by default, even when we redirect the program’s output (e.g. a.out > output_file).
Redirect error messages by: a.out 2> error_file
Example:if ( (fp=fopen(“p.txt”,”r”)) == NULL){ fprintf(stderr,”Cannot open file\n”); exit(1);}