Chapter 3 C language statement analysis
Const int * grape;
Int const * grape;
Int * const grape;
In the last case, the pointer is read-only, and the above two pointers indicate that the object is read-only;
Struct can be used for field bits. I have never heard of it before:
[Cpp]
# Include <stdio. h>
Int main (){
Struct bit_field {
Unsigned int a: 1;
Unsigned int B: 4;
Unsigned int c: 8;
};
Struct bit_field temp;
Temp. a = 1;
Printf ("% d \ n", temp. );
Return 0;
}
If one line of code only does one thing, it looks simpler. For this reason, the declaration of variables should be separated from the declaration of types;
Some C-language books claim that "when calling a function, the parameters are pushed into the stack in the order from right to left". This is too simple-if you have a book like this, tear down the page and burn it. If you have such a compiler, delete the lines in the source code of the compiler. Parameters are first stored in registers as much as possible during transmission (for speed );
Integration has both advantages and disadvantages. Its determination is what the so-called advantages are actually not very good. The advantage of union is that it looks the same as the structure, but it replaces the keyword struct with the keyword union;
[Cpp]
# Include <stdio. h>
Int main (){
Enum sizes {small = 7, medium, large = 10, humungous };
Printf ("% d \ n", small );
Printf ("% d \ n", medium );
Printf ("% d \ n", large );
Printf ("% d \ n", humungous );
Return 0;
}
The usage of enumeration is roughly the same as above;
There are two types of big data: one is a parameter and the other is not a parameter.
From CodeBlog