#include<stdio.h>
int main(void)
{
static int i=i++, j=j++, k=k++;
printf("i = %d j = %d k = %d", i, j, k);
return 0;
}
Output in Turbo C 4.5 :
i = 0 j = 0 k = 0
In gcc I’m getting the error:
Initializer element is not constant
Which one is logically correct ? I’m in bit confusion..
Standard says about initialization (6.7.8):
(That’s from C99, but C89 says almost exactly the same thing.)
So it looks as though GCC is more correct than 15-year old abandonware. (Who’d a thunk it?)