int end=i+2*(col-1);
what does this tell me when I have a for-loop around it with i being its iterator. And “col” is an integer value;
int end=i+2*(col-1);
what does this tell me when I have a for-loop around it with i being its iterator. And “col” is an integer value;
Says that whatever is declared next defines the conclusion.
i + 2 * (col - 1)
but end
itself must be tested.
Aside:
Don’t be scared to use a little whitespace. It goes to readability.
Just took a second look at it and it blew my mind. Its used for creating a matrix of a certain squared number. I was typing it in as
int end = i*2+(col-1);
instead of typing it correctly as:
int end = i*row+(col-1); //when inserted inside the first for-loop;
Yes, int end, row, and col are integer values.
Thanks!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.