This is so because of undefined behavior.
There is no definition or concept (for example, range of values which can be called garbage or alike) of "garbage" value in regards to C standard. The behaviour is undefined, so anything could happen. There is no guarantee that after invoking the UB, the program would (or would not, for that matter) continue execution to produce (or not to produce) any output, at all.
Related, quoting C11
, chapter §3.4.3, undefined behavior
behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
for which this International Standard imposes no requirements
Possible undefined behavior ranges from ignoring the situation completely with unpredictable
results, to behaving during translation or program execution in a documented manner characteristic of the
environment (with or without the issuance of a diagnostic message), to terminating a translation or
execution (with the issuance of a diagnostic message).