4 ms·
Just split them into separate variable definitions: int i1 = 1; int i2 = 2; The "usual footgun" is: int i1, i2, i3 = 0; Only i3 will be initiali
by flohofwoe 6y ago
Just split them into separate variable definitions:
int i1 = 1;
int i2 = 2;
The "usual footgun" is:
int i1, i2, i3 = 0;
Only i3 will be initialized in this case. And since one needs to write out the assignments anyway, adding the type for each variable doesn't hurt either.
(today's compilers usually have uninitialized-warnings for this though, but sometimes people forget to add a -Wall to their compiler options, especially beginners, and then get stuck on such trivial problems).
- thrwaeasddsaf 6y agoSorry I can't read your comment, could you split your words into separate paragraphs?