c语言数据结构和数据类型_C语言中的数据类型
c语言数据结构和数据类型
Data types specify how we enter data into our programs and what type of data we enter. C language has some predefined set of data types to handle various kinds of data that we can use in our program. These datatypes have different storage capacities.
数据类型指定了如何将数据输入到程序中以及输入什么类型的数据。 C语言具有一些预定义的数据类型集,以处理我们可以在程序中使用的各种数据。 这些数据类型具有不同的存储容量。
C language supports 2 different type of data types:
C语言支持2种不同类型的数据类型:
Primary data types:
主要数据类型 :
These are fundamental data types in C namely integer(
int
), floating point(float
), character(char
) andvoid
.这些是C语言中的基本数据类型,即integer(
int
),浮点数(float
),character(char
)和void
。Derived data types:
派生数据类型 :
Derived data types are nothing but primary datatypes but a little twisted or grouped together like array, stucture, union and pointer. These are discussed in details later.
派生数据类型不过是主要数据类型,而是有点扭曲或组合在一起的数组 , 结构 , 联合和指针 。 这些将在后面详细讨论。
Data type determines the type of data a variable will hold. If a variable
xis declared as
int. it means x can hold only integer values. Every variable which is used in the program must be declared as what data-type it is.
数据类型确定变量将保存的数据类型。 如果变量
x声明为
int。 这意味着x只能容纳整数值。 程序中使用的每个变量都必须声明为数据类型。
整数类型 (Integer type)
Integers are used to store whole numbers.
整数用于存储整数。
Size and range of Integer type on 16-bit machine:
16位计算机上整数类型的大小和范围:
Type | Size(bytes) | Range |
---|---|---|
int or signed int | 2 | -32,768 to 32767 |
unsigned int | 2 | 0 to 65535 |
short int or signed short int | 1 | -128 to 127 |
unsigned short int | 1 | 0 to 255 |
long int or signed long int | 4 | -2,147,483,648 to 2,147,483,647 |
unsigned long int | 4 | 0 to 4,294,967,295 |
类型 | 大小(字节) | 范围 |
---|---|---|
int或signed int | 2 | -32,768至32767 |
无符号整数 | 2 | 0至65535 |
short int或有符号short int | 1个 | -128至127 |
无符号short int | 1个 | 0至255 |
long int或有符号long int | 4 | -2,147,483,648至2,147,483,647 |
无符号长整数 | 4 | 0至4,294,967,295 |
浮点型 (Floating point type)
Floating types are used to store real numbers.
浮点类型用于存储实数。
Size and range of Integer type on 16-bit machine
16位计算机上整数类型的大小和范围
Type | Size(bytes) | Range |
---|---|---|
Float | 4 | 3.4E-38 to 3.4E+38 |
double | 8 | 1.7E-308 to 1.7E+308 |
long double | 10 | 3.4E-4932 to 1.1E+4932 |
类型 | 大小(字节) | 范围 |
---|---|---|
浮动 | 4 | 3.4E-38至3.4E + 38 |
双 | 8 | 1.7E-308至1.7E + 308 |
长双 | 10 | 3.4E-4932至1.1E + 4932 |
角色类型 (Character type)
Character types are used to store characters value.
字符类型用于存储字符值。
Size and range of Integer type on 16-bit machine
16位计算机上整数类型的大小和范围
Type | Size(bytes) | Range |
---|---|---|
char or signed char | 1 | -128 to 127 |
unsigned char | 1 | 0 to 255 |
类型 | 大小(字节) | 范围 |
---|---|---|
字符或签名字符 | 1个 | -128至127 |
无符号的字符 | 1个 | 0至255 |
空类型 (void type)
voidtype means no value. This is usually used to specify the type of functions which returns nothing. We will get acquainted to this datatype as we start learning more advanced topics in C language, like functions, pointers etc.
void类型表示没有值。 通常用于指定不返回任何内容的函数类型。 当我们开始学习C语言中更高级的主题(例如函数,指针等)时,我们将熟悉此数据类型。
c语言数据结构和数据类型
- 在C语言中,double long unsigned int char 类型数据所占字节数
- Python笔记(2)——数据类型和数据结构
- 关于一个c语言中的小陷阱(数据类型之间的转换)
- C语言中各种数据类型长度的总结:(参考The C Programming Language)
- C语言运算中的数据类型自动转换原则
- 李洪强漫谈iOS开发[C语言-012]-C语言基本数据类型
- C语言基本数据类型
- c语言常量变量和数据类型
- 关于ARM的C语言数据类型
- C语言数据类型
- c语言重温笔记(2)--数据类型
- C语言数据类型问题及答疑
- 【C语言】03 基本数据类型
- C语言笔记之数据类型(一)
- Poedu_C语言提升_Lesson02_20161111_数据类型2
- 【考研408数据结构】数据类型(一)
- 在C语言中,double、long、unsigned、int、char类型数据所占字节数
- C语言 从零开始 最基本最详细 (2) 数据类型
- 在C语言中各种数据类型各占多少位
- (转载)C语言数据类型