C language, this question compilation preprocessing is a bit incomprehensible??

Updated on educate 2024-05-01
9 answers
  1. Anonymous users2024-02-08

    The macro definitions are replaced before execution, and the order is from the inside to the outside by default, so your **df(f(b,a)) above will first become df(b>a?(b a) :(b%a)), and then the outer layer of df becomes.

    2*b>a?(b/a):(b%a)

    If you want to get the result of f first and then calculate df, there are many ways to do this, such as the simplest is to define df(k) 2*k.

    #define df(k) 2*(k)

    So that the top will become.

    2*(b>a?(b a):(b%a)) The result is 16 Note: When defining macros, you can use and to control the order, but generally not much, if you are interested, you can learn about it.

  2. Anonymous users2024-02-07

    Because the C compiler is what makes the necessary substitutions when it sees define, and then compiles.

    See f(b,a) replaced with: b>a?(b/a):

    b%a) see df(f(b,a)) replaced with: 2*b>a?(b/a):

    b%a) is equivalent to what you wrote in the program: x=2*b>a?(b/a):

    b%a);It would be prudent not to make a mistake to bracket the definition of define, e.g.

    #define f(a,b) (a>b?(a b):(a%b)) define df(k) (2*k) is defined as 2*(k).

  3. Anonymous users2024-02-06

    Preprocessing instructions begin with , and there are four main types of prefixes: 1macro definition, define; 2.

    The stool contains include; 3.conditional compilation, ifdef, etc.; 4. The compiler controls the pragma para command. Mastering these four jujube blades is almost the same.

  4. Anonymous users2024-02-05

    The preprocessing phase is mainly to deal with macro instructions, such as include directives, define directives, conditional compilation directives, etc.

    The compilation stage is mainly to check the syntax errors of C language programs, that is, whether the written ** conforms to the rules of C language, and the compilation is based on. cThe source file is compiled into units. obj file (or is. o files).

    Pointer exceptions, array subscripts out-of-bounds, these errors are semantic errors, which can only be found at the time of execution, and these are also called runtime errors.

  5. Anonymous users2024-02-04

    Precompilation is to put the more stable ** precompilation in a project into a file. These pre-compiled ** can be any C C++ **. After entering the program, it just compiles the ** into an obj (object) file, and all the obj files are linked to become an executable file.

    And the execution you said should be generated by clicking on the last. exe file. The include at the beginning is to indicate the header file to be included, or other saved files.

    Only then can you reference the ** in that file for use in the current file.

    As for the programming of the big game you mentioned, it should be like this, because the C language is the routine of the above generated files. Game programming, beginners can recommend reading "Introduction to Game Programming" (Mei Haben), this book is based on the Windows platform, is written for beginners with little to no experience in game development, step by step, from 2D to 3D some basic technologies, the examples are also very classic, after reading the book, you can basically make a good 2D game, and there is a certain 3D foundation, and then read some in-depth books like "Windows Game Programming Master Skills".

  6. Anonymous users2024-02-03

    When I first started learning, I continued to read and there were explanations.

  7. Anonymous users2024-02-02

    Are you self-taught? I've talked about all of this in class.

  8. Anonymous users2024-02-01

    1. Yes, there is a paragraph of information in the obj file.

    2. No, the heap is assigned to you by the runtime when it is running (the VC runtime library under Windows is actually the heap provided by the system), and the system assigns it to you when the stack is running, and there is no information about how big the stack is in the compiled obj (this is added when linking).

    The statement that the logical address of the global variable is unchanged is correct when the dynamic base address is not enabled, and the same global variable is in the same location every time the exe is loaded into memory. However, after enabling dynamic base addresses in Windows, the exe may be loaded to a different address each time, and the memory address of the global variable will change at this time.

  9. Anonymous users2024-01-31

    1 OBJ file runtime, runtime assigned to you (in fact, under Windows VC runtime system heap) piece information.

    Heap, stacker run, system assigned to you, inside actually compiled obj stack segments and other information (this link, and go).

    The global variable is immutable, and this statement is not open to dynamic base addresses that are correct, in the future each exe file is loaded into memory with a logical address, a global variable, in the same location. However, open the window to dynamic base address, each time the exe file may be loaded to a different address, which will change the memory address of the global variable.

Related questions
6 answers2024-05-01

In C, all preprocessing commands start with a " " sign.

The concept of preprocessing in C programming: processing before compilation. There are three main aspects of preprocessing in C: macro definition and failing. >>>More

12 answers2024-05-01

An escape character is a special form of representation of characters in the C language. Escape characters are commonly used to represent non-printable control characters and function-specific characters in the ASCII character set, such as the one-apostrophe (which is used to represent character constants'), which is used to represent a double apostrophe (") and backslashes (etc. Escape characters are represented by a backslash followed by a character or an octal or hexadecimal number. >>>More

4 answers2024-05-01

2. 1, True 2, False (there is only one program) 3, False (not necessarily) 4, True. >>>More

6 answers2024-05-01

The procedure is as follows,You can paste your**,Everyone**There is a mistake there.,ACM's questions pay attention to formatting.,It's wrong to get the format wrong.。 >>>More

10 answers2024-05-01

Here's an example of using C++ to implement a number deletion operation for a given rule >>>More