<1> on the first day of blog creation, I am very happy! Just write a little simple, then the data type, constants and operators (C language), new operators
[Data type]
1 --- bool
- # Include <stdbool. h> (header files specific to the bool type)
- The boolean type has only two values: 0 and 1.
2 --- char
3 --- int occupies 4 bytes
- Short occupies 2 bytes
- Long occupies 4 bytes
4 --- float occupies 4 bytes (float type is decimal type, such as 12.34)
5 --- default void type (to put it bluntly, it is an empty type)
[Constant]
1 ---- integer constant
- Decimal: 23
- Octal: 023
- Hexadecimal: 0x23
2 ---- floating point Constants
3 ---- exponential constant
4 ---- character constant (the character is enclosed by a pair of single quotes)
5 ---- String constant (the string is enclosed in a pair of double quotation marks)
- "A": 'A' \ 0'
- "Hello": 'H' 'E' E' l 'l' o ''\ 0'
- The character string defaults to 0, which is '\ 0'. Therefore, the string "A" contains two characters: 'A' and' \ 0 '.
6 ---- macro definition
- # Define N 12
- Macro definition: In my understanding, it is generally to define the data -----> that is, you do not need to change the number of its values when using it.
- For example, you define an integer type array int a [N];
- Then, if you want to change its space to 64, you can define # define N 64
[Operator] (I don't think it's good to remember it by force. Remember it when you use it)
1 ---- Arithmetic Operators
2 ---- Relational operators
- <<=>>==! =
- The result of the relational operation is in either of the following States: 0 1
3 ---- logical operations
- &: The operation represents a false value.
- |: Or indicates true.
- ! : False or false.
The result of the logical operation is only in two states: 0 1
Short-circuit principle: When an expression can determine the result of the entire expression, the following expression does not operate.
4 ---- bitwise operation (mostly used for unsigned integer operations)
- &: Bitwise AND, false
- |: Bit or, true
- ~ : Reverse, true or false, false or true
- ^: Returns an exclusive or. The same value is 0. The difference is 1.
- >>: X> n <=> x/2 ^ n
- <: X <n <=> x * 2 ^ n
5 ---- compound Operators
- + =-= * =/= % =
- ^ = & = | = <=> =
Data exchange:
6 ---- conditional Operators
- <Expression 1>? <Expression 2>: <expression 3>;
- First Judge expression 1. If it is true, execute expression 2. If it is false, execute expression 3;
7 ----, (comma)
8 ---- forced type conversion
- Conversion between similar data types.
9 ---- sizeof
In fact, I personally think this is a very important function.
- For example:
- Evaluate the size of the Data opening space
- For example, you define an array int a [] = {1, 2, 3, 4, 5, 6, 7, 8}. Suppose there are many elements in the array, you need to know the size of a and you will have sizeof ();
- Or you want to know the sizeof (int) Size of an int type );