I am a beginner in c programming I am trying something, but not able to understand this properly
#include<stdio.h>
int main()
{
int x=5,y=10;
printf("%d %d %d %d\n",x++,y++,++x,++y);
}
I am a beginner in c programming I am trying something, but not able to understand this properly
#include<stdio.h>
int main()
{
int x=5,y=10;
printf("%d %d %d %d\n",x++,y++,++x,++y);
}
This:
printf("%d %d %d %d\n",x++,y++,++x,++y);
Is not well-defined code. The reason is that in C, the order of evaluation of function arguments is not defined. So it could do the various increments in any order, and therefore we can't say what the output should be. The code is defective.