Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Simple data types of C language include
Simple data types of C language include
What are the basic types of data in C language?

Short, int, long, char, float and double, these six keywords represent six basic data types in C language. Integer int, long integer and long floating point type, decimal type includes single precision floating point type and double precision floating point type. Char is a character type. In C language, 0 stands for false false, and 1 stands for true. In some compilers, there are also Boolean types and pointer types, that is, variable types that store variable addresses.

The simple data types in C language are:

1, integer (number) type

Int: basic integer type, used to store integers, accounting for 4 bytes; The default value is 0, and the data range is-2147483648 ~ 2147483647.

Short: short integer, accounting for 2 bytes, stored in the same way as the basic integer int, with the data range of -32768-32767.

Long: long integer, accounting for 4 bytes, and the data range is -2 63 ~ 2 63- 1.

Long long: double integer, accounting for 8 bytes, and the data range is-263 ~ 263-1; This data type is generally less used.

2, floating-point type

Float: single-precision floating-point type, accounting for 4 bytes, with significant digits (6~7 bits) and data range of-3.4 *1038 ~+3.4 *1038.

Floating-point variables are composed of limited storage units, so they can only provide a limited number of significant digits, and the digits beyond the significant digits will be inaccurate, which may cause some errors.

Double: double-precision floating-point type, accounting for 8 bytes, with significant digits (15~ 16 bits) and data range of-1.7 *10-308 ~1.7 */kloc-0.

3. Character type

Char: Character type, used to store a single character, accounting for 1 byte.

Note: char array in C language is used to store strings.