Saturday, 17 August 2013

Explain output of following C program

Explain output of following C program

#include <stdio.h>
main()
{
int a=1;
printf("%d %d %d %d %d\n",++a,a++,++a,++a,a++);
a=1;
printf("%d %d %d %d %d",a,a++,a,++a,a);
}
When I run it , it gives following output.
6 4 6 6 1
3 2 3 3 3
Please explain the code.

No comments:

Post a Comment