Current location - Training Enrollment Network - Mathematics courses - Mathematical macro
Mathematical macro
It is clearly stipulated in the C language that macro definition is to replace a string with a specified identifier with the #define command. The title corresponds to the #define identifier string, so pi is the identifier and 3. 14 15926 is the string. So choose B for this question.

With regard to the c option, if 3. 14 15926 is not in the macro function definition, then it is a constant, and just because it is in the #define command, it is a string.

Option A, single-precision number refers to a way for the computer to represent the approximation of real numbers, not just to determine the value, so it is wrong.

D option, double precision number is also a way for numerical computer to represent real number approximation, not just a clear numerical value, so it is wrong. But it is slightly different from single-precision numbers. Reflected in the range of numbers.

Extended data

Macro is a preprocessing instruction, which provides a mechanism to replace strings in source code.

1, conditional compilation:

In C language, the preprocessing process reads the source code, checks the statements and macro definitions containing preprocessing instructions, and converts the source code accordingly. The preprocessing process will also delete comments and redundant blank symbols in the program.

The preprocessing instruction is a line of code starting with #, and # must be the first character of the line except the blank character. # followed by the instruction keyword, and several blank characters are allowed between # and the instruction keyword.

2. Macro function:

Calling a function takes some time and space. Because when the system calls a function, it needs to keep the "position", that is, push the position of the next instruction to be executed by the program onto the stack, and then pass it to the calling function for execution. After the function is called, return to the main function, restore the "site", and return to the position of the next instruction saved in the stack to continue execution.

Therefore, the function calls need extra time and space.

The macro function does not have the above problems. When the macro function is precompiled, the function name is replaced by the code defined by the function, and the function code segment is embedded in the current program, so that the function call will not occur.