The second day of IOS learning, and the second day of IOS Learning
IOS Learning (C Language) knowledge point sorting notes
1. 32 keywords in C Language
I. Storage-related
1) auto declares automatic Variables
2) register declares register variables
3) variables declared by volatile may be implicitly changed during program execution.
4) const declares Read-Only variables
5) the extern declaration variable is declared in other files.
6) static declaration of static variables
7) signed declares signed variables or functions
8) unsigned declares unsigned variables or functions.
Ii. Data Types
1) short declares short integer variables or functions
2) int declares integer variables or functions
3) long declares long integer variables or functions
4) float declares floating point variables or functions
5) double declares double Precision variables or functions
6) char declares struct variables or functions
7) struct declares struct variables or functions
8) union declares Public Data Types
9) enum declares the enumeration type
10) void declares that the function has no return value or no parameter declaration has no type pointer.
Iii. Logical Control
1) if condition judgment statement
2) The else Condition Statement denies the branch (used with if)
3) A for loop statement
4) do loop statement body
5) while loop statement condition judgment Section
6) Terminate the loop or close other branches in the switch statement.
7) continue ends the current loop and starts the next loop
8) return subprogram return Statement (which can contain parameters or parameters)
9) other condition branches in the default switch statement
10) switch statement
11) case switch statement Branch
12) goto unconditional jump statement
Iv. Special Purposes
1) sizeof computing data type Length
2) typedef is used to alias the data type.
2,Hexadecimal
1) binary two basic states (0 and 1) every two first weights 2 ^ (n-1) Mark 0b (for example: 0b1111 = 15)
2) 8 basic statuses (0 ~ 7) Each octal hash value is 8 ^ (n-1) 0 (for example, 0100 = 64)
3) 10 basic states in decimal format (0 ~ 9) 10 to 10 values (n-1)
4) hexadecimal 16 Basic states (0 ~ 9, ~ F) x 16 to 16 ^ (n-1) Mark 0x (for example, 0x111 = 273)
5) convert binary to octal, compress every 3bits, and convert binary to three bits (for example, 0126 = 0b001, 010,110 = 64 + 16 + 4 + 2 = 86)
6) convert binary to hexadecimal. Compress every 4 bits into hexadecimal. Convert binary into 4 bits (for example, 0x56 = 0b0101, 0110 = 64 + 16 + 4 + 2 = 86)
7) octal and hexadecimal are the sequence of Binary-assisted hexadecimal conversion.
10-> (except 16 times) 16-> (4 bits tensile) 2-> (3bits compression) 8
8-> (3bits stretching) 2-> (4bits compression) 16-> (weight addition) 10
8) 0 ~ Binary Number of 15
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001
10 = 1010
11 = 1011
12 = 1100
13 = 1101
14 = 1110
15 = 1111
3,Three yards
1) three codes are divided into the original code, reverse code, and complement code.
2) Number of original codes with symbols. The highest bit is the symbol bit, followed by the negative number of the Data bit.
Assume that 8 bits is used to represent a signed number. The last seven digits of the first digit number are numerical values, for example: (9 + (-6 ))
9 original code:
-6 original code: 1000,011 0
_________________________________________________________________________________
, 1111 (result of adding the original code:-15 result error [9 + negative 6 = 3] That is, the original code cannot be involved in the operation)
3) the anticode of the positive number is equal to the negative number of the original code (positive number: anticode = original code ).
Example: (9 + (-6) the binary values are added to the binary values.
9 original code: reverse code:
-6 original code:, reverse code: 1111,1001
______________________________________________________________________________________
(Result of inverse code addition: 2 result error [9 + negative 6 = 3] That is, the inverse Code cannot be involved in the operation)
4) the positive value of the complement code is equal to the original code (positive value = original code). The negative value of the complement code is equal to the inverse code plus one (negative value = reverse code + 1)
Example: (9 + (-6) the binary values are added to the binary values.
9 source code: Second, 1001 reverse code: Second, 1001 complement: Second, 1001
-6 source code:, reverse code: 1111,1001 completion code: 1111,1010
________________________________________________________________________________________
(The result of the complement code addition is 3. The result is correct, that is, the complement code can be involved in the operation)
(5) 8 bits indicates a signed number ranging from ~ 256 changes in and
Positive Value ~ 0111,1111 (Completion code 0 ~ 127) 0x7f
Negative ~ 1111,1111 (Supplemental Code) (-128 ~ -1)
-1 = 1111,1111 (Supplemental Code)-1111,1110 (reverse Code)-, (original code)
-127 = 1111,1111 (original code),-, (reverse code),-, (Supplemental code)
-128 = (complement, 1111,1111 (reverse code), (original code)
6) 8 bits indicates an unsigned number: 0 ~ 255
7)Storage in Computer
1 bit binary = 1 bit 1 Byte = 8 bits
1Kb = 1024 Bytes
1 Mb = 1024Kb
1 Gb = 1024 Mb
1 Tb = 1024 Gb
200 Gb = 200*1024*1024*1024 Bytes
8) programmer's Day: 2nd ^ 8 days of each year (0b1111, 1111): January 1, of the year of a leap
9) input and output with spaces: char str []; scanf ("% [^ \ n]", str); printf ("% s \ n ");
10) the length of each data type in the system with different digits
Integer char short int long
64-bit system, 1-byte, 2-byte, 4-byte, 8-byte (Mac system)
32-bit system 1 byte 2 byte 4 byte 4 byte 8 byte (previous embedded development environment arm, dsp)
16-bit system, 1-byte, 2-byte, 2-byte, 4-byte (small hardware such as single chip microcomputer)
The sizeof () function can be used to verify the sizeof (int)
11) Various Data Types indicate the range of numbers
Char 1 byte, 8 bits,
Signed quantity:-128 ~ 127,-2 ^ 7 ~ 2 ^ 7-1
No. of symbols 0 ~ 255 (0 ~ 0xff) 0 ~ 2 ^ 8-1
Short 2 bytes, 16 bits
Signed quantity:-32768 ~ 32767,-2 ^ 15 ~ 2 ^ 15-1
Unsigned number: 0 ~ 65535,0 ~ 2 ^ 16-1
Int 4 bytes, 32 bits
Signed quantity:-2 ^ 31 ~ 2 ^ 31-1
Unsigned number: 0 ~ 2 ^ 32-1
Long 8 bytes, 64 bits
Signed quantity:-2 ^ 63 ~ 2 ^ 63-1
Unsigned number: 0 ~ 2 ^ 64-1
Long 8 bytes, 64 bits
Signed quantity:-2 ^ 63 ~ 2 ^ 63-1
Unsigned number: 0 ~ 2 ^ 64-1
Float, 4 bytes
Double floating point type, 8 bytes
Long double long dual-precision floating point type, 16 bytes
12) several common ASCII code comparison values
A ~ Z (65 ~ 90) ~ Z (97 ~ 122)
Del = 127 @ = 64 \ n = 10 \ r = 13