Tip of the week#3: Use of ++ and —
++ and — are the unary operators for incrementing and decrementing the variables.
Let us take an example.
int i = 10; i = i + 1;
int i = 10; i++;
Although the above two example perform the same task, there is a significant difference (in ms) in the time required to execute the above two.
The execution of the instruction “i = i + 1” takes more time than “i++”.
Unary operators produce fewer instructions and run faster.