设为首页 加入收藏

TOP

2.5 References (3)
2013-10-07 15:26:14 来源: 作者: 【 】 浏览:74
Tags:2.5 References

EXERCISES SECTION 2.5

Exercise 2.24: Which of the following definitions, if any, are invalid Why How would you correct them

(a) int ival = 1.01; (b) int &rval1 = 1.01;

(c) int &rval2 = ival; (d) const int &rval3 = 1;

Exercise 2.25: Given the preceeding definitions, which, if any, of the following assignments
are invalid If they are valid, explain what they do.

(a) rval2 = 3.14159; (b) rval2 = rval3;

(c) ival = rval3; (d) rval3 = ival;

Exercise 2.26: What are the differences among the definitions in (a) and the assignments
in (b) Which, if any, are illegal

(a) int ival = 0; (b) ival = ri;

const int &ri = 0; ri = ival;

Exercise 2.27: What does the following code print

  1. int i, &ri = i;  
  2. i = 5; ri = 10;  
  3. std::cout << i << " " << ri << std::endl; 
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇5.10.1 Precedence 下一篇2.5 References (2)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·常用meta整理 | 菜鸟 (2025-12-25 01:21:52)
·SQL HAVING 子句:深 (2025-12-25 01:21:47)
·SQL CREATE INDEX 语 (2025-12-25 01:21:45)
·Shell 传递参数 (2025-12-25 00:50:45)
·Linux echo 命令 - (2025-12-25 00:50:43)