cpluspluscourse icon indicating copy to clipboard operation
cpluspluscourse copied to clipboard

Operator exercise for first day?

Open hageboeck opened this issue 2 years ago • 1 comments

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.

hageboeck avatar Mar 17 '22 10:03 hageboeck

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.

stale[bot] avatar Jul 19 '22 18:07 stale[bot]

Some things that could be part of this exercise:

  • Type promotion
  • Operator precendence
  • Braces
  • Pitfalls with precendence?

hageboeck avatar Feb 22 '23 14:02 hageboeck

x *= 2.; // Promotes to double
x / 2; // might truncate?

hageboeck avatar Feb 22 '23 14:02 hageboeck

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.

stale[bot] avatar Feb 22 '24 23:02 stale[bot]