Open main menu

CDOT Wiki β

Changes

Week 2

285 bytes added, 11:33, 19 May 2010
no edit summary
The Question Mark Operator
''c = a > b ? 100 : 200;''
c = 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.'''
It replaces an if statement and is much faster. If a is greater than b then 100, else 200.<u>Function Calls</u>
''printf("%d %d, b, b = b + 1);''
Please note: The types 100 It returns 21 21. Why? Some compilers stack the arguments and 200 must be read the same type or else last argument first. Therefore, it will not workwould see b as 21 as well.
''a = printf("%d %d, b, b = b + 1);
<u>Function Calls</u>printf("%d\n", a);'' What is a?
printf("%d %d, b, b = b + 1);6
It printf returns 21 21. Why? Some compilers stack the arguments and read number of characters printed (scanf also returns the number of characters input - special note: scanf cannot return a number greater than the last argument first. Therefore, it would see b as 21 as well% symbols in your scanf statement).
1
edit