Different outputs on vs code and replit.com

33 views Asked by At

I am trying to run this code which is written in C language. It is giving different outputs when run on VS code and Replit.com. I am confused. Please explain

#include <stdio.h>
int main()
{
    int x = 1, y = 6, z = 0;
    printf("\n x=%d \n z=%d \n y=%d", x, z, y);
    printf("\n xpo=%d \n xpre=%d \n xpos=%d", x++, ++x, x++);
    return 0;
}

VS code is giving the following output:

x=1
z=0
y=6
xpo=3
xpre=4
xpos=1

And replit.com is giving this output:

x=1
z=0
y=6
xpo=1
xpre=3
xpos=3
0

There are 0 answers