2.4 const Qualifier (3)

2013-10-07 15:25:18 · 作者: · 浏览: 71

EXERCISES SECTION 2.4

Exercise 2.22: The following program fragment, while legal, is an example of poor style. What problem(s) does it contain How would you improve it

for (int i = 0; i < 100; ++i)
// process i

Exercise 2.23: Which of the following are legal For those usages that are illegal, explain why.

(a) const int buf;

(b) int cnt = 0;

const int sz = cnt;

(c) cnt++; sz++;