4.10. Comma Operator
The comma operator takes two operands, which it evaluates from left to right. Like the logical AND and logical OR and the conditional operator, the comma operator guarantees the order in which its operands are evaluated.
Exercises Section 4.9
Exercise 4.28: Write a program to print the size of each of the built-in types.
Exercise 4.29: Predict the output of the following code and explain your reasoning. Now run the program. Is the output what you expected? If not, figure out why.
int x[10]; int *p = x;cout << sizeof(x)/sizeof(*x) << endl;cout << sizeof(p)/sizeof(*p) << endl;
Exercise 4.30: Using Table 4.12 (p. 166), parenthesize the following expressions to match the default evaluation:
(a) sizeof x + y
(b) sizeof p->mem[i] ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access