2.2 Literal Constants (7)

2013-10-07 15:25:11 · 作者: · 浏览: 69

EXERCISES SECTION 2.2

Exercise 2.7: Explain the difference between the following sets of literal constants:

(a) ’a’, L’a’, "a", L"a"

(b) 10, 10u, 10L, 10uL, 012, 0xC

(c) 3.14, 3.14f, 3.14L

Exercise 2.8: Determine the type of each of these literal constants:

(a) -10 (b) -10u (c) -10. (d) -10e-2

Exercise 2.9: Which, if any, of the following are illegal

(a) "Who goes with F\145rgus \012"

(b) 3.14e1L (c) "two" L"some"

(d) 1024f (e) 3.14UL

(f) "multiple line comment"

Exercise 2.10: Using escape sequences, write a program to print 2M followed by a newline. Modify the program to print 2, then a tab, then an M, followed by a newline.