On 07/17/2010 05:17 AM, Mihai Donțu wrote: > On Saturday 17 July 2010 06:48:35 Peter wrote: >> I have the following code compiled in both microsoft VC 2008 and gcc >> version 4.1.2 20071124. >> >> The output is different. >> >> #include<stdio.h> >> void main(void) >> { >> int i,tab[]={1,2,3,4,5,6,7,8,9,10}; >> >> i=0; >> while(i<10){ >> printf("%d ",i); >> printf("%d:%d\n",i,tab[i++]); >> } >> } >> >> [...] >> >> based on C standard, whose output is correct? >> thanks. > > GCC's, although it's interesting that visual studio does what one expects: Actually, both are correct. Andrew.