Commonly used data types in c language

1. Character type char:

a byte.

Used to store a small range of integers (-128~127), and "characters" (all ASCII characters, 128).

char a = 97;

char b = 'a'; //'a' character constant

2. Integer type:

4 bytes.

Used to store integers, range: 2 to the 31st power to 2 to the 31st power -1

 

3, long shape long:

long is long int

used to store integers

On 32-bit systems, 4 bytes, the same as int

On 64-bit systems, 8 bytes

 

4, long long shape long long:

8 bytes

 

5, float type (single precision type)

Representation: stored in scientific notation, that is, "mantissa" and "exponent" need to be stored

 

float x = 1.75E5; // 175000 is 1.75 times and 10 to the 5th power, just save the mantissa 1.75 and the exponent 5.

 

float y = 1.123456789 //Note here, the precision can only be up to 1.1234568 , and the 7th bit (the integer part is not counted) will be rounded by itself , that is, printf("%f", y);//1.1234568 will be rounded by itself of

Precision: up to 7 significant digits (referring to 7 decimal digits)

 

6, double type (double precision floating point type)

Used to store data with fractional parts

8 bytes

Precision: up to 16 significant digits (referring to 16 decimal digits)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325824360&siteId=291194637