Obs:
- I'm using Ubuntu 20.04.
- I compiled the program with gcc version 9.3.0.
- Using zsh instead of bash (Although to use bash also does not work, just changes a little bit the huge number)
CodePudding user response:
The declaration:
int c, nl, ns, nt = 0;
Only initializes nt. To initialize nl and ns as well, you need:
int c, nl = 0, ns = 0, nt = 0;
CodePudding user response:
Only variable nt is initialized. Variables c, nl and ns are uninitialized. You can avoid this by declaring them on separate lines and initializing individually to zero or adding = 0 after each.
How can I declare and define multiple variables in one line using C ?