On page 176, after declaring the FILE structure, the authors declare an array of 20 FILE structs called _iob and define stdin to be &_iob[0], stdout to be &_iob[1], and &_iob[2] to be stderr. So far so good.
On page 177, their implementation of the fopen function has the following loop:
Code:
for (fp = _iob; fp < _iob + OPEN_MAX; fp++)
if ((fp->flag & (_READ | _WRITE)) == 0)
break; /* found free slot */
The flag member for any of the structs in the array is not initialized, so how is this loop going to work? Thanks in advance.