Postfix and prefix expressions
Postfix expressions
Postfix expressions can be recognized by the following examples.
a++;
i--;
Note that there is no other postfix/prefix expressions such as a// and i**. The symbol ++ means plus one.
However, the variable is first used and is later added by 1 and stored into memory. Thus the word postfix. This can be seen much more clearer in the following animation
Hover on the C statements to understand better.
Prefix expressions
Prefix expressions, as its name suggests, that the value of the variable is added by 1 first and stored in the memory which will be used later. Examples:
++a;
++i;
This is also the same as a = a+1 and i= i+1;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment