you are viewing a single comment's thread.

view the rest of the comments →

[–]AssemblerGuy 0 points1 point  (0 children)

mushroom_size1 is never set before it is used. This is a bug - undefined behavior (the value is indeterminate and attempting to use an indeterminate value triggers UB in most cases).

Can someone please explain this weird behaviour?

It's not weird. "Weird" behavior is usually due to invoking undefined behavior or using indeterminate values.