iOS learning (c language) knowledge points to organize notes
——————————————— Next day Notes ——————————————————
1, C language 32 keywords
first, storage-related
1) Auto Declaration automatic variable
2) Register Declaration register variable
3) Volatile declaration variables may be implicitly altered during program execution
4) Const declaration read-only variable
5) extern declaration variable is declared in other file
6) static variable declaration
7) signed declares a signed type variable or function
8) Unsigned declaring a variable or function of an unsigned type
ii. Types of data
1) Short declaration of variable or function
2) int declares an integer variable or function
3) long declares a length integer variable or function
4) float declares floating-point variable or function
5) Double-declaration variable or function
6) Char declares a character variable or function
7) struct declares struct-body variable or function
8) Union declaration common data type
9) enum Declaration enum type
void declaration function no return value or no parameter declaration untyped pointer
third, logical control
1) If Condition judgment statement
2) Else conditional statement Negation branch (with IF)
3) One of the For loop statements
4) loop body of Do Loop statement
5) The conditional judgment part of the while Loop statement
6) Break ends the loop or closes other branches in the switch statement
7) Continue end of the current cycle start the next round cycle
8) Return subroutine returns a statement (with or without parameters) loop condition
9) Other conditional branches in the default switch statement
Switch statement
One) Case Switch statement Branch
Goto Unconditional Jump Statement
Iv. Special uses
1) sizeof Calculate data type length
2) typedef used to alias data types
2. binary
1) Binary 2 basic states (0 and 1) every 2^ (n-1) identifier 0b (e.g. 0b1111=15)
2) Octal 8 basic State (0~7) every octal one weight value 8^ (n-1) identifier 0 (for example: 0100=64)
3) Decimal 10 basic State (0~9) every ten into one weight value 10^ (n-1)
4) Hex 16 basic State (0~9,A~F) 16 in one 16^ (n-1) identifier 0x (for example: 0x111=273)
5) binary turn octal per 3bits compression octal to binary one stretched to 3bits (e.g. 0126=0b001,010,110=64+16+4+2=86)
6) binary to hex 4bits compressed hex to binary one stretched to 4bits (e.g. 0x56=0b0101,0110=64+16+4+2=86)
7) octal and hexadecimal are binary binary binary conversion sequence.
10-> (except 16 remainder) 16-> (4bits stretch) 2-> (3bits compression) 8
8-> (3bits stretch) 2-> (4bits compression) 16-> (weight added) 10
8) 0~15 binary number
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 yards divided into original code, anti-code, complement
2) The original code signed number, the highest bit is the sign bit, followed by the data bit negative sign bit is 1 positive sign bit is 0
Assuming that a 8bits is used to represent a signed number, the first digit number is seven digits after the number of symbols for example: (+ + (-6))
9 The original code: 0000,1001
-6 of the original code: 1000, 0110
_________________________________________________________________________________
1000,1111 (The result of the original code addition:-15 result error [+ minus 6=3] i.e. the original code cannot participate in the operation)
3) Anti-code positive inverse code equal to the original code (positive: Anti-code = original code) negative number of the inverse code for the symbol bit invariant the original code other bits take the reverse
For example: (+ + (-6)) binary addition every two in one
9 The original code: 0000,1001 Anti-code: 0000,1001
-6 of the original code: 1000,0110 Anti-code: 1111,1001
______________________________________________________________________________________
0000,0010 (Inverse code addition results: 2 results Error [+ minus 6=3] that is, the inverse code can not participate in the operation)
4) The complement of a positive complement is equal to the original code (positive complement = The original code) the complement of the negative is equal to the inverse code plus one (negative complement = inverse code + 1)
For example: (+ + (-6)) binary addition every two in one
9 The original code: 0000,1001:0000,1001 Complement: 0000,1001
-6 of the original code: 1000,0110 Anti-code: 1111,1001 Complement: 1111,1010
________________________________________________________________________________________
0000,0011 (the result of the complement of 3 results is that the correct complement can participate in the operation)
5) 8bits representation of a signed number 0000,0000~1111,1111 a total of 256 variations
Positive number: 0000,0000~0111,1111 (complement 0~127) 0x7f
Negative number: 1000,0000~1111,1111 (complement) ( -128~-1)
-1=1111,1111 (complement) -1111,1110 (anti-code) -1000,0001 (original code)
-127=1111,1111 (original code), -1000,0000 (Inverse code), -1000,0001 (complement)
-128=1000,0000 (complement, 1111,1111 (anti-code), 1000,0000 (original code)
6) 8bits representation of an unsigned number: 0~255
7) storage in the computer
One binary =1bit a byte 1byte=8bits
1kb=1024bytes
1mb=1024kb
1gb=1024mb
1tb=1024gb
200gb=200*1024*1024*1024bytes
8) Programmer's Day
The 2nd ^8 Day of the Year (0b1111,1111) is: September 12 common year of leap years, September 13
iOS stage learning the next day notes