Yeah, that was odd, I wonder if it was some kind of elaborate typo. Heap allocation is much worse in C than in Go because you're responsible for freeing everything you heap allocate.
There are only a few good reasons to heap allocate in C:
You're writing a library and want to be able to add fields to your data structures without breaking ABI compatibility.
You need to return dynamically sized chunk of data, whose length can't be known to the caller ahead of time, like a string. Still consider returning it by writing to a statically sized buffer passed as an argument, piecewise, as in read().
You need a growable buffer. Still consider allocating a reasonable maximum sized buffer and BOUNDS CHECKING.
Some library requires you to dynamically allocate to use its API. Oh well.
You want to maintain API consistency and that requires dynamically allocating something that doesn't strictly need to be.
Don't be dogmatic, but stack allocation, and occaisionally static allocation are much more maintainable than dynamic allocation.
There are only a few good reasons to heap allocate in C:
You're writing a library and want to be able to add fields to your data structures without breaking ABI compatibility.
You need to return dynamically sized chunk of data, whose length can't be known to the caller ahead of time, like a string. Still consider returning it by writing to a statically sized buffer passed as an argument, piecewise, as in read().
You need a growable buffer. Still consider allocating a reasonable maximum sized buffer and BOUNDS CHECKING.
Some library requires you to dynamically allocate to use its API. Oh well.
You want to maintain API consistency and that requires dynamically allocating something that doesn't strictly need to be.
Don't be dogmatic, but stack allocation, and occaisionally static allocation are much more maintainable than dynamic allocation.