Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What's the difference between int, float, double and char in C language?
What's the difference between int, float, double and char in C language?
The difference lies in the following aspects:

I. Definition:

1 and int are integers, which are used to define integer data.

2.float is a single-precision floating-point type, which can be accurate to six decimal places.

3.double is a double-precision floating-point type, which can be accurate to 12 digits after the decimal point.

4.char is a character type, which is used to define data of character type.

Second, the memory occupation:

The memory size of 1 and int is 4 bytes.

2. The size of floating-point memory is 4 bytes.

The memory size of 3.double is 8 bytes.

4. The memory size of 4.char is 1 byte.

The table of basic data types is as follows:

Third, the data range:

1, int: the number ranges from -(3 1 to-1), and the number is-2147 483 647 ~ 2.

2. Double: the range is+1.1111165438. 38+011* 21023 (1.521) is 1.7 * 10 308. The same is true of negative numbers.

3.float: integer limit is 3.4 * 10 38, and so is negative number.

4、char:- 128- 127 .

References:

Baidu Encyclopedia-Data Type