设为首页 加入收藏

TOP

CHAPTER 2 VARIABLES AND BASICTYPES
2013-10-07 16:15:40 来源: 作者: 【 】 浏览:80
Tags:CHAPTER VARIABLES AND BASICTYPES

CONTENTS

Section 2.1 Primitive Built-in Types . . . . . . . . . . . 32

Section 2.2 Variables . . . . . . . . . . . . . . . . . . . . 41

Section 2.3 Compound Types . . . . . . . . . . . . . . . 50

Section 2.4 constQualifier . . . . . . . . . . . . . . . . 59

Section 2.5 Dealing with Types . . . . . . . . . . . . . . 67

Section 2.6 Defining Our Own Data Structures . . . . 72

ChapterSummary . . . . . . . . . . . . . . . . . . . . . . 78

DefinedTerms . . . . . . . . . . . . . . . . . . . . . . . . . 78

Types are fundamental to any program: They tell us what our data mean and what operations we can perform on those data.

C++(www.cppentry.com) has extensive support for types. The language defines several primitive types (characters, integers, floating-point numbers, etc.) and provides mechanisms that let us define our own data types. The library uses these mechanisms to define more complicated types such as variable-length character strings, vectors, and so on. This chapter covers the built-in types and begins our coverage of how C++(www.cppentry.com) supports more complicated types.
Types determine the meaning of the data and operations in our programs. The meaning of even as simple a statement as

  1. i = i + j;  

depends on the types of i and j. If i and j are integers, this statement has the ordinary, arithmetic meaning of +. However, if i and j are Sales_item objects (§ 1.5.1, p. 20), this statement adds the components of these two objects.

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇2.3 Compound Types (2) 下一篇2.1 Primitive Built-in 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)