Increment to arrays

I couldn't discover the logic of the program that how it increment array and print out value.Is there any one who can explain it for me?
1
2
3
4
5
6
7
8
#include <iostream>
using namespace std;
int main()
{
	int a[3]={7,5,3};
			cout <<  a[1] << ++a[1] << a[1] <<  ++a[1] <<  a[1] <<++a[1] << a[1] <<++a[1]<< a[1] << endl;
return 0;
}
I couldn't discover the logic of the program that how it increment array and print out value.

There is no logic in undefined behavior.

See: http://stackoverflow.com/questions/949433/why-are-these-constructs-using-undefined-behavior?lq=1
Topic archived. No new replies allowed.