but still my first question: is about ending the if condition line with a ;
The if condition does not end with a semicolon. It is the statement to be executed when the test returns true that ends with a semicolon.
and starting with the {do something code} as if the if condition is still open.
I believe that this is the section of code that you are looking at
do {
inString[inCount] = Serial.read(); // get it
if (inString [inCount] == INTERMINATOR) break;{
(++inCount < INLENGTH);
inString[inCount] = 0; // null terminate the string
}
}
while (Serial.available()); // wait for input
Here it is reformatted with added comments
do
{
inString[inCount] = Serial.read(); // get it
if (inString [inCount] == INTERMINATOR)
{
break;
}
{ //not needed
(++inCount < INLENGTH); //brackets not needed
inString[inCount] = 0; // null terminate the string
} //not needed
}
while (Serial.available()); // wait for input
And what about
(++inCount<inLength);
is it equivalent to?
if (inCount<inLength) inCount++;
No it is not equivalent, but the original code does not look it works anyway. It shows all the signs of having been revised without thought, hence the extra braces and brackets