Joke Collection Website - Cold jokes - When eight programmers crashed, I broke the defense.
When eight programmers crashed, I broke the defense.
1. Declare a constant with preprocessing instruction #define to show how many seconds there are in 1 year (leap years are ignored).
# define sec _ year (365 * 24 * 60 * 60) ul inspection point: 1. # Define the basics of grammar (for example, don't end with a semicolon, use parentheses, etc.). ) .2. Know that the preprocessor will help you calculate the value of the constant expression, so it is clearer and more cost-free to write directly how you calculate how many seconds there are in a year instead of calculating the actual value.
3. Realize that this expression will overflow an integer of 16 bit machine-so use the long integer symbol L to tell the compiler that this constant is a long integer. 4. If you use u (for unsigned long integer) in the expression, then this is a good starting point. Remember, the first impression is very important.
2. Write a "standard" macro MN, which inputs two parameters and returns the smaller one.
# define MIN(a, b) ((a) <; =(b)? (1): (2) Inspection point: 1. Basic knowledge of logo #define application in macro. This is very important. Because before inline operators become part of standard C, macros are the only way to generate embedded code conveniently. For dry embedded systems, in order to achieve the required performance, embedded code is often a necessary method. 2. Know how to carefully enclose parameters in parentheses in macros. I also used this question to discuss the side effects of macros.
3. What is the purpose of preprocessor identification #error?
When compiling a program, whenever you encounter #rror, you will get a compilation error. Since it is a compilation error, why? Its purpose is to ensure that the program compiles as you imagine. #ifdef XXX...# Otherwise ... #endif
When the program is large, some macro definitions are often specified externally (such as makefile) or in the system header file. When you are not sure whether XXX is currently defined, you can compile it like this: # ifdefxxx # error“XXX has been defined "# else # endif. In this way, if there is an error during compilation, it means that XXX has been defined, which means that the macro XXX has been defined.
4. Infinite loop is often used in embedded systems. How to write infinite loop in C language?
while( 1),for(; ; ), loop:. ..., go to the loop.
5. Use the variable a to give the following definition.
A)- an integer.
A pointer to an integer.
C) pointer points to pointer, and pointer points to integer (pointer points to pointer of integer).
D) 10 array of integers.
E) An array with 10 pointers, which point to an integer. (an array? 10 pointers to integers).
F) Pointer to 10 integer array.
6. What is the function of the keyword static?
In C language, the keyword static has three obvious functions: First, when modifying variables, the static modified local variables are only executed once, extending the life cycle of local variables until the program runs.
Second, when static modifies a global variable, the global variable can only be accessed in this file, but not in other files, even if it is declared by extern.
Third, static modifies a function, so the function can only be called in this file, not by other files. Static modified local variables are stored in the static variable area of the global data area. Automatically initialized to 0 at initialization.
7. What does the keyword const mean?
As long as a variable is modified by const, it means that the data in the variable can only be accessed and cannot be modified, which means the cost "read-only" rule: whoever const is close to cannot be modified; When cost modifies a variable, it must be initialized. If it is not initialized, it cannot be initialized later.
8. What does the keyword volatile mean? And give three different examples.
A variable defined as volatile means that the variable may be changed accidentally, so the compiler will not adopt the value of the variable. To be precise, the optimizer must carefully re-read the value of this variable every time it is used, instead of using the backup stored in the register. Here are some examples of variable variables:
1: hardware registers (such as status registers) of parallel devices.
2. Non-automatic variables to be accessed in the interrupt service subroutine.
3. Variables shared by multiple tasks in multithreaded applications.
- Previous article:What are the jokes in 2007?
- Next article:Transfer joke
- Related articles
- Excerpts from the most disgusting copywriting paragraphs of the little milk dog coquetry (60 sentences)
- Foreign actresses tell cold jokes
- Heartbroken copywriting
- What if you can't talk on stage! I don't know how to say it! I'm afraid I'm poor! Afraid of jokes
- What does the tire 22565r 17 mean?
- Every time my husband cuts vegetables, he tells me not to cut my hands. Every time I eat, he calls me and sends me messages to remind me. It’s really annoying.
- How about Andy's acting skills in the fairy couple?
- 23 tips on blind dates, suitable for both men and women.
- Grade 9 English Page 34 2d Translation
- Why can't Miao Xiu, given to tourists by Miao girls, be accepted casually?