output difference between VC and gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 
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++]);
    }
}

the output from VC is:
0  0:1
1  1:2
2  2:3
3  3:4
4  4:5
5  5:6
6  6:7
7  7:8
8  8:9
9  9:10

the output from gcc is:

0  1:1
1  2:2
2  3:3
3  4:4
4  5:5
5  6:6
6  7:7
7  8:8
8  9:9
9  10:10


based on C standard, whose output is correct?
thanks.




      



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux