What is difference between Postfix and Prefix Operators?
int n=0, m=0; n = ++m; /*first increment m, then assign its value to n*/ cout << n << m; /* display 1 1*/
int n=0, m=0;
n = m++; /*first assign m's value to n, then increment m*/
cout << n << m; /*display 0 1*/
No comments:
Post a Comment