Firstly, don't attempt to use SO **
markup inside code blocks. It doesn't work as intended and it only creates confusion.
Secondly, the book is apparently outdated. Back in the very old versions of C language there was no void *
type and char *
type was typically used instead as "generic" pointer type. The first parameter of fread
was declared with char *
type. For this reason it was customary to perform explicit cast of actual argument type to char *
to avoid compiler warnings. It might even be necessary today, if an old version of standard library is used (one that declares fread
with char *
parameter).
Modern C standard library declares fread
with first parameter of type void *
. No cast is necessary in that case and cast to char *
makes no sense at all.