1 Array 1.1 Concepts
An array is a type of data that is stored sequentially in memory. The brackets ([]) are the identifiers of the arrays, and the values inside the brackets identify the number of variables of that data type, and the brackets also take the value .
1.2 Array use
int a[10]={1,2,3,4,5,6,7,8,9,0}; --Definition of the array
int *p=&a[1]; --a[1], is the value of array A in memory 1 position, &a[1], is the address of a[1]
P[6] is equal to 8--p[6], which is the starting position of &a[1], and the value of the sixth position is taken up.
1.3 Integer Array zeroing 1.3.1 Bzero ()
can only clear zero.
1.3.2 memset ()
Can be set to the specified value. However, only the low of each byte is placed to the specified value. For example:
int a[5] = {1,2,3,4,5};
memset (A,2,sizeof (a));
for (int i=0; i<5; i++) {
printf ("%d", a[i]); --The printed value is: 10000000100000001000000010
}
2 Storage class Keywords 2.1 auto
Used only in variable declarations with code block scope, decorated with local variables.
2.2 Register
Can only be a local variable and is a type acceptable to the CPU and cannot be accessed. Can greatly improve the computational efficiency.
2.3 Static
(1) static modifier global variable, initialized only once, to prevent the use of other files.
(2) Static modifies the local variable, and the static variable is not freed when the function is executed.
(3) static modifier function, which can only be used in this file.
2.4 extern
Declares that a variable or function can be called externally.
2.5 Const3 The operation of symbolic shaping and unsigned shaping
int main (void)
{
unsigned int a = 6;
int b =-20;
char c;
(a+b>6)? (c=1):(c=0);
return 0;
} is c=1, but a+b=-14; If a is of type int then c=0.
When the original signed number and unsigned number are compared (==,<,>,<=,>=), the signed number is implicitly converted to an unsigned number (that is, the underlying complement does not change, but this number is changed from the signed number to the unsigned number),
For example above (A+B) >6 This comparison operation, A+B=-14,-14 's complement is 1111111111110010. when this number is compared, it is treated as an unsigned number , which is far greater than 6, so the result is obtained.
4 original code, anti-code, complement
Because the true value of the original code of the symbol is inaccurate, there is an inverse code, because 0 this special value, so the appearance of the complement. So, the processor calculates the complement.
Analysis of special knowledge points in C language