What should I do if I'm not sure why a variable might become zero?

Responsive Ad Header

Question

Grade: Education Subject: Support
What should I do if I'm not sure why a variable might become zero?
Asked by:
66 Viewed 66 Answers

Answer (66)

Best Answer
(313)
If you're unsure why a variable could be zero, use a debugger to step through the code and trace the value of the variable at different points. Look for any operations that might be setting the variable to zero unintentionally. Review calculations carefully to ensure there are no errors that could lead to this.