3 ms·
It's not a C89 requirement. C89 requires variables to be declared at the top of a block, not a function. So, you could write things like this: while (...) {
by trealira 2y ago
It's not a C89 requirement. C89 requires variables to be declared at the top of a block, not a function. So, you could write things like this:
while (...) {
int a = 1, b = 2, c = 3;
printf("%d\n", a + c - b);
}
- jamesfinlayson 2y agoAh okay - I misremembered - I only had to work with strict C89 once and that was close to 15 years ago now, and at a similar time I inherited a codebase that did things the C89 way but it was compiled as C++ so with no enforcement of variables at the top of blocks I didn't really pay attention to where things had been declared when it was first written.