3 ms·
We might be saying the same thing here, but modern C scopes variables down to the block. So if you have a variable declared for instance inside of a for loop o
by jandrese 3y ago
We might be saying the same thing here, but modern C scopes variables down to the block. So if you have a variable declared for instance inside of a for loop or if statement, that variable is out of scope once you exit the block.
This will fail to compile with an "undeclared identifier" error:
if ( x > 0 )
{
int y = 1;
}
printf("%d", y);
It is a feature that was long overdue in C IMHO.