...
In the example below, assuming the size of buf that sizeof(buf)
is equal sizeof(size_t) + (sizeof(char) * 50)
, which would equal 54 (assuming sizeof(size_t)
is 4) is incorrect. The sizeof(buf) may actually evaluate to a larger value due to structure padding.
...