Wednesday, 1 February 2017

Pre and Post Increments


We cannot use pre and post in a single statement because it is compiler dependent program....
like 
int a =10;
cout<<++a + a++ + a++;
It is absolutely compiler dependent program..



int A=900, B=100;
A++;
cout<<A<<endl;
++B;
cout<<B<<endl;
int A=900, B=100;
A+=B++;
cout<<A<<B<<endl;
A+=++B;
cout<<A<<B<<endl;
900
101
1000101
1102102

No comments:

Post a Comment