dimanche 29 mars 2015

Why the two declaration is different [duplicate]




This question already has an answer here:





#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
int i=2,int j;
j=i++ + i++ + ++i + i++ + i++ + i++ + ++i;
printf("%d %d",j,i);
getch();
}
main()
{
clrscr();
int i=2;
int j=i++ + i++ + ++i + i++ + i++ + i++ + ++i;
printf("%d %d",j,i);
getch();
}


Consider the above code i have declared j then use it in the expression but if i declared j inline the output changes .in both the above case turbo c++ 3.0 compiler gives different result why??please explain




Aucun commentaire:

Enregistrer un commentaire