+ 2
Please explain me about Prefix and Postfix
exp. x=10 y=6 y=x++ cout<<++y; and, wht about 3 or more variable? many thanks.
2 Respuestas
+ 3
Prefix : = ++x;
postfix = x++;
prefix adds the value of the variable by 1 before processing the line of code.
Postfix processes the line of code before adding the value of the variable by 1.
Example :
int x = 10;
int y = ++x; // x and y becomes 11.
int z = y++; // y becomes 12 , z becomes 11.
0
many thanks, K2