设为首页 加入收藏

TOP

2.2 Variables (6)
2013-10-07 16:16:25 来源: 作者: 【 】 浏览:79
Tags:2.2 Variables

EXERCISES SECTION 2.2.2

Exercise 2.11: Explain whether each of the following is a declaration or a definition:

(a) extern int ix = 1024;

(b) int iy;

(c) extern int iz;

KEY CONCEPT: STATIC TYPING

C++(www.cppentry.com) is a statically typed language, which means that types are checked at compile time. The process by which types are checked is referred to as type checking.

As we’ve seen, the type of an object constrains the operations that the object can perform. In C++(www.cppentry.com), the compiler checks whether the operations we write are supported by the types we use. If we try to do things that the type does not support, the compiler generates an error message and does not produce an executable file.

As our programs get more complicated, we’ll see that static type checking can help find bugs. However, a consequence of static checking is that the type of every entity we use must be known to the compiler. As one example, we must declare the type of a variable before we can use that variable.

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇2.2 Variables (8) 下一篇2.3 Compound Types (1)

评论

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

·数据库:推荐几款 Re (2025-12-25 12:17:11)
·如何最简单、通俗地 (2025-12-25 12:17:09)
·什么是Redis?为什么 (2025-12-25 12:17:06)
·对于一个想入坑Linux (2025-12-25 11:49:07)
·Linux 怎么读? (2025-12-25 11:49:04)