Current location - Training Enrollment Network - Mathematics courses - C Language Learning Summary (2) Floating-point, Character and Mathematical Operators
C Language Learning Summary (2) Floating-point, Character and Mathematical Operators
Learning summary

A, floating-point type:

Floating-point type in C language corresponds to decimal in mathematics. There are two types of floating point: float and double. Use the same way, the difference is.

Represents range and precision. Float has small measuring range and low precision (6 decimal places); Double precision means large range and high precision.

Tall man. (After decimal point 16 digits)

Range indicates how big the number is, and precision indicates how fine the resolution of this number is.

Note: the type of float or double is printed in printf. If %f is used, %d cannot be used.

Second, the personality type:

The character type corresponds to ASCII characters. ASCII character is a kind of coding, and it is a way to represent a symbol by digital coding.

In essence, character types are actually plastic, but these plastic numbers are used to represent ASCII coded values of certain characters.

It's called personality type. Character types are generally represented by 8-bit binary, and the range of unsigned character types is 0~255.

Character type is actually a shorter molding than short, so you can use int operation.

Signed and unsigned numbers:

Numbers in mathematics are signed, including integers and negative numbers. So the data types in the computer are also signed and divided into signed ones.

Numbers and unsigned numbers.

Signature number:

Integer:

? Signed integer (abbreviation of integer)

? Signed long, also written as signed long int, (abbreviated as long)

? Signed short, also written as signed short int (abbreviation)

? Signed (used for signed integers)

Floating-point type:

? Signed floating point number (abbreviated as float)

? Signed double (short double(double)

Character type:

? Signed character (abbreviation of character)

Unsigned number:

Shaping: whether there is a sign number in shaping, which is used to represent some coding numbers and so on. Such as ID number and room number.

Unsigned integer (no abbreviation)

Unsigned long integer (abbreviated as unsigned long integer)

Unsigned short integer (unsigned short integer)

Floating point number: There is no unsigned floating point number. In other words, decimals are generally only used in mathematical concepts, and they are all signed.

Character Type: Whether the character type is signed.

Unsigned characters (no abbreviations)

Note: For plastic and character types, the ranges of signed and unsigned numbers are different.

For example, for character types, the signed number ranges from-128 to 127, and the unsigned number ranges from 0 to 255.

Third, mathematical operators.

Common mathematical operation symbols are the same as those in mathematics.

+plus sign

-Negative sign

* Multiplication symbol

/quotient after division

% takes the sign of remainder. What is the remainder after division?

Multiply first, then divide, then add and subtract. If there are () brackets, count them first.

() brackets have the highest priority. Do the math first.