V
vippstar
Hello comp.lang.c
I had to write a for() loop with two temporary variables for it.
What I *usually* do is define the variables at the top so it works in
C89 as well.
But I realized that it just can't be done in the C99 'for' loop!
Assume I want two variables, int i and size_t size.
for(int i, size_t size; ...; ...)
is a syntax error
Is there a way to do this? I'm not talking about putting these two
types in a struct.
Assuming this can't be done, isn't the addition of defining variables
in the first part of the for loop in C99 useless, or at least
"incomplete"?
I had to write a for() loop with two temporary variables for it.
What I *usually* do is define the variables at the top so it works in
C89 as well.
But I realized that it just can't be done in the C99 'for' loop!
Assume I want two variables, int i and size_t size.
for(int i, size_t size; ...; ...)
is a syntax error
Is there a way to do this? I'm not talking about putting these two
types in a struct.
Assuming this can't be done, isn't the addition of defining variables
in the first part of the for loop in C99 useless, or at least
"incomplete"?