Hi I'm new to c program here :) may I know how can I use two variable for one for loop statement can I just declare like this. However I saw some online people said that by declaring this way the system will take the second value and neglate the first value is this true ?
take the second value and neglate the first value is this true ?
Yes, expressions separated by comma are evaluated but only the last will return a value. Thus sector<4 will be ignored. Note that what an expression within the comma list is depends on the precedence of the operators. The comma has a low precedence. See:
Also, based on previous code where variables sector any y were used, I'd suspect "none of the above" might be what is really needed.
More probably - and I'm guessing here since there clearly isn't enough information in this thread, you would want a nested loop -that is two individual loops, one contained inside the other
1 2 3 4 5 6 7
for (sector=0; sector<4; sector++)
{
for (y=0; y<5; y++)
{
}
}
... or possibly the inner and outer could be the other way around.