admin管理员组文章数量:1613374
Chapter 02 Description of Simple Data
1. Data Type
Data type is composed of value set and operation set and can be divided into primitive data type and compound data type.
In terms of the requirement of declaration on data type, programming language can be classified as:
- Statically typed language call for declaration on type of each data and usually executed by compiling.
- Dynamically typed language doesn’t need to claim data type and usually executed by interpreting.
2. Fundamental Data Type
Fundamental data type is predefined by the language and is also called standard type or built-in type.
Fundamental data type is mostly arithmetic type.
2.1 Integral Type
1. integer type
int
short int
orshort
, ranging from -32768 to 32767, occupying 2 byte.long int
orlong
Range(short int) <= Range(int) <= Range(long int)
Unsigned integer is twice the range of usual integer type.
2. character type
char
Character is stored in computer as ASCII, which means American Standard Code for Information Interchange.
3. boolean type
bool
Boolean type has only two value:
true
orfalse
, whiletrue
is often stored as1
andfalse
is often stored as0
.
2.2 Real Type
Real type is also called float point type in C++.
float
double
long double
Range(float) < Range(double) <= Range(long double)
2.3 Void Type
void
Void type is used to describe the type of the return value of a function that actually doesn’t return a value.
2.4 Some Operations
-
We can use function
sizeof(<type-name>)
to get the space(byte) that needed to store this type of data. -
We can use keyword
typedef <existing-type-name> <new-name>
to rename an existing type, for example:typedef unsigned int Uint; //Remember that typedef just rename an existing data type, rather than creating a new data type.
本文标签: fundamentalbptypeData
版权声明:本文标题:BP-2-1 Fundamental Data Type 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728643415a1167397.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论