Question 1
Back to Exercise
What is the value of int count; declared inside a function, before it is assigned?
- A 0
- B 1
- C Indeterminate (garbage) – reading it is a bug Correct
- D -1
Correct Answer: Option C
Automatic variables are not initialised. Their memory holds whatever was there before, and using the value is undefined behaviour in many cases. Always initialise locals.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!