What makes this number pop up out of nowhere? #21406
-
Hi so I’m currently learning C and i’ve accidently found out something while playing with variables. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
If you call |
Beta Was this translation helpful? Give feedback.
-
I’m aware of that, but shouldnt it give null value instead of the number “199…” I don’t understand why it specifically gives that value |
Beta Was this translation helpful? Give feedback.
-
That depends on your compiler and C library. “Undefined behavior” means they can do anything. Give some number, crash, draw a bunny on the screen… anything. In practice it’s most likely an artifact of how See also: Undefined behavior - Wikipedia |
Beta Was this translation helpful? Give feedback.
That depends on your compiler and C library. “Undefined behavior” means they can do anything. Give some number, crash, draw a bunny on the screen… anything. In practice it’s most likely an artifact of how
printf()
is implemented. 😅See also: Undefined behavior - Wikipedia