Why initialize a variable?
When I'm writing snippets in C++, I frequently declare with int x; or something, then later assign or cin.get a value. Now sometimes I read: No, you should initialize a variable always and immediately, so that it doesn't contain random stuff. No real reason is given. Also sometimes I read there was a huge difference between initialization and assignment, where in my mind it should be the same, only that before the first assignment there's still stuff at that place that's been marked as overwriteable. So... why's it any different? Now when I think about writing a large code that is fragmentarized into .cpps, .hpps etc., I'd declare my stuff separately as you then do; would I really set everything to 0, 0.0, "", {} or whatever just to assign other values later anyway? What is your opinion about it? Why is it better to initialize?