Can I write simply
for (int i = 0; ...
instead of
int i;
for (i = 0; ...
in C or C++?
(And will variable i
be accessible inside the loop only?)
Can I write simply
for (int i = 0; ...
instead of
int i;
for (i = 0; ...
in C or C++?
(And will variable i
be accessible inside the loop only?)
Yes and yes. But for C, apparently your compiler needs to be in C99 mode.