Using sizeof with fgets()
The code above sets the maximum length using the
sizeof operator. Be careful with this.
sizeof returns the amount
of space occupied by a variable. In the code above,
food is an array variable, so
sizeof returns the size of the array. If
food was just a simple pointer
sizeof operator would
have just returned the size of a pointer.
Sizeof with fgets()
Share this highlighthttp://www.safaribooksonline.com/a/head-first-c/62381/