The path to learning C is long, and today we begin to learn about variables and constants.
Integer variables are used to store integers, and integer variables can be signed, unsigned, long, and short.
long int amount;//-length integer
Long amount;//length integer type
Signed int total;//signed integral type
Signed total;//signed integral type
unsigned int offset;//unsigned integral type
unsigned offset;//unsigned integral type
short int smallamt;//Quick-integer
Short smallamt;//shorter integer type
Floating-point variable: used to store a real number with a decimal number.
Float amount;//Single Precision type
Double bigamount;//dual Precision Type
Long double reallybigamount;//length dual precision type
Character variable
The characters that are stored are characters in the computer's character set.
Char ch;//declares a character-type variable, and the identifier is ch.
A constant is an immutable quantity and is a constant. Constants are integer constants, floating-point constants, character constants, string constants, escape character constants, and address constants.
Integral type constant
Can be long integer, short integer, signed type, unsigned
Floating-point constants
A floating-point constant consists of an integer and a decimal part:
floatnumber=1.6e10f;//signed floating-point type
All floating-point numbers are defaulted to double.
Character-type constants
The value represented is the value that a character variable can contain, and an ASCII expression can be used to represent a character constant or to denote an escape character with a backslash in single quotation marks.
such as ' A ', ' \x2f ', ' \013 ' \x indicates that the following character is hexadecimal, and that the following character is an octal number.
String constants
A string constant is a string of characters enclosed in double quotation marks.
Escape character
\, single quotation mark
\ \ counter Slash
\ n line break
\ r return character
\ t Horizontal tab
The address constant &counter & is the address character that takes the address of a variable or function.
Variables and constants