C Bug Hunt Easy +10 XP
Uninitialized Variable
This code has undefined behavior.
CFind the bug
1
int x;2
printf("%d", x); The bug is on line 1
Select the correct fix
Show answer and explanation
Answer: Both A and B fix it
Local variables in C are not automatically initialized. Reading an uninitialized variable is undefined behavior.
Hint: C doesn't zero-initialize local variables.
What this challenge tests
Bug Hunt in C: variables, undefined-behavior.