Any other critique on formatting efficiency will be appreciated
One thing that immediately sticks out is that you are not initialising the value of
comm before you check its value.
But that’s the first thing I did in the for loop ?
Here is my code
Not able to find any difference between your code and my code
The check is performed before you enter the body of the loop.
So probably a freak case ?
You mean like this ? Still doesn’t work
No - I mean you should initialise the value of
comm before you check it XD
I really don’t understand what else you mean
Can you please type it out
Give comm a value before checking its value in any condition! Read about difference between declaration and initialisation.
Like this - see the change on line 21:
Thank you so much , your help is very much appreciated but why was this causing error after all eventually a value was gonna go into comm
if you don’t give it a value to begin with, then the initial value of
comm is undefined i.e. it’s allowed to have any value at all, including
0. If it happens to have the initial value
0, then the
for loop simply never gets executed at all.