One, the binary
1. What is a binary
* is a way of counting, the representation of a numeric value
2. Binary
* Features: only 0 and 1, every 2 into 1
* Writing format:0b or 0b start
* Application: Binary instruction \ binary file, variable in memory is binary storage
3. octal
* Features:0~ 8 in 1
* Writing format:0 start
4. hex
* Features:0~f, 1 in every
* Writing format:0x or 0x start
Second, bitwise operations
1. & Press at
1> features
Only the corresponding two binaries are 1, the result bit is 1, otherwise 0.
2> Law
Binary, with 1- phase & to remain in place, and 0 -phase & is 0
2. | bitwise OR
1> features
As long as the corresponding two binaries have 1 for 1 , the result is 1, otherwise 0.
3. ^ bitwise XOR or
1> features
When the corresponding binary is different (not the same), the result is 1, otherwise 0
2> Law
* The result of the same integer ^ is 0. For example 5^5=0
* multiple integers ^ results are independent of order. For example 5^6^7=5^7^6
* thus concludes:A^b^a = b
4. ~ Take back
The binary of Integer A is reversed, and the sign bit is reversed (0 to 1, 1 to 0)
5. << shift left
All the binary of the integer A is left n bits, the high is discarded, and the low is 0.
6. >> Move right
shift all the binary in integer A to the right n bits, keeping the sign bit constant.
three, array
1. features of the array
* only one type of data can be stored, such as an array of type int , An array of type float
* data stored inside is called " element "
2. format
Element type array name [ number of elements ];
Like what:
int ages[3];
3. Initialize
int a[3] = {1,2,3}; int a[] = {1,5,%}; int a[5] = {[2]=6,+// Indicates starting from subscript 2 initialization, if the subscript is exceeded, there will be a warning, the runtime will not error int// error
Four, String
1. Initialization of strings
* "123" is actually by '1','2','3',' \0 ' composition
2. commonly used string processing functions
Strlen ()
06-Binary, bitwise operations, arrays, and strings