cpluspluscourse
cpluspluscourse copied to clipboard
Operator exercise for first day?
Consider this comment by Attila:
The description of vector iterators made me remember that we don't discuss this really in this tutorial. But it may be useful to be aware already at a beginner level. What do you think, what values will b and c take in the following example?
int a = 5;
int b = a++;
int c = ++a;
We may consider playing with this a bit during the first day.
This issue or pull request has been automatically marked as stale because it has not had recent activity. Please manually close it, if it is no longer relevant, or ask for help or support to help getting it unstuck. Let me bring this to the attention of @klieret @wdconinc @michmx for now.
Some things that could be part of this exercise:
- Type promotion
- Operator precendence
- Braces
- Pitfalls with precendence?
x *= 2.; // Promotes to double
x / 2; // might truncate?
This issue or pull request has been automatically marked as stale because it has not had recent activity. Please manually close it, if it is no longer relevant, or ask for help or support to help getting it unstuck. Let me bring this to the attention of @klieret @wdconinc @michmx for now.