what is file * in stdio.c souce file in glibc that has & operator

Viewed 33
#include "stdio.h"

#undef stdin
#undef stdout
#undef stderr
FILE *stdin = (FILE *) &_IO_2_1_stdin_;
FILE *stdout = (FILE *) &_IO_2_1_stdout_;
FILE *stderr = (FILE *) &_IO_2_1_stderr_;

What do these file * lines mean in the stdio.c file in glibc source code, what does the & operator mean in the last three lines. what is IO_2_1_stdin, is it a file or what does & operator mean in that line?

1 Answers

stdin, stdout and stderr are the standard streams required by the spec. These are their definitions. Each points to a matching implementation-defined structure - in this case, those structures are global variables named _IO_2_1_stdin_, etc. The & is the normal address-of operator.

Related