Week 2

From CDOT Wiki
Revision as of 12:29, 19 May 2010 by Jaburton1 (talk | contribs) (Created page with '<u>Reviewing IPC 144</u> The Question Mark Operator c = a > b ? 100 : 200; It replaces an if statement and is much faster. If a is greater than b then 100, else 200. Pleas…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Reviewing IPC 144

The Question Mark Operator


c = a > b ? 100 : 200;


It replaces an if statement and is much faster. If a is greater than b then 100, else 200.


Please note: The types 100 and 200 must be the same type or else it will not work.


Function Calls

printf("%d  %d, b, b = b + 1);

It returns 21 21. Why? Some compilers stack the arguments and read the last argument first. Therefore, it would see b as 21 as well.