C C defines can t replace or with , so what function can be used to replace the symbol?

Updated on technology 2024-08-07
15 answers
  1. Anonymous users2024-02-15

    What exactly are you talking about, whether it's a word in quotation marks or in quotation marks.

  2. Anonymous users2024-02-14

    define is essentially equivalent to string replacement, that is, replacing the text in your **, so it is not of any type in itself, it can be a number, it can be a word, etc., such as define aaa 5

    Well when you use it like this.

    int a= aaa ;

    It's like defining a number.

    And if you are. #define aaa tom

    int tom,jerry;

    jerry=aaa;

    This, in turn, is equivalent to defining a word (identifier), equivalent to jerry=tom;

    So, define has nothing to do with types, it's equivalent to replace**.

  3. Anonymous users2024-02-13

    define is a macro definition, not a variable definition.

    To put it bluntly, it just serves as a simple text replacement, only at compile time. Once the compilation is complete, the macro doesn't exist.

    So, define has nothing to do with variable types, you can define whatever you want. You can even define a paragraph, a function, ......

    For example: define a 1000

    #define b "helloworld"

    #define c 'c'

    #define d

    #define max(x,y) (x)>(y)?(x):(y))

    #define log(msg) fprintf(stderr, "%s", msg);

    #define list(folder) myfile *f = get_file_list(folder);

    while (f != null) \

  4. Anonymous users2024-02-12

    Yes, define is just a replacement at compile time, you can define anything, data, strings, functions, identifiers.

  5. Anonymous users2024-02-11

    1. define is a macro definition, and the program will replace it with the content of the definition in the preprocessing stage. Therefore, when the program is running, there is no constant defined with define in the constant table, and the system does not allocate memory for it. The constants defined by const exist in the constant table when the program is running, and the system allocates memory for it.

    2. The constants defined by define are only directly replaced during preprocessing, so the data type cannot be checked at the time of compilation. Constants defined by const can avoid errors by performing strict type verification at compile time.

    3. Pay attention to the "edge effect" when defining expressions.

    For example: definen1+2;

    floata=n/;

    As is customary, the result might be assumed to be 3 2=;

    But in reality, the result should be 1+2;

    If you want to implement 3 2, then definen(1+2);

    That is, to avoid edge effects, be sure to add parentheses.

  6. Anonymous users2024-02-10

    1. define is a macro definition, in the preprocessing stage, the program will replace the content defined by define, so when the program runs, there is no constant defined with define in the constant table, the system will not allocate memory for it, when the program runs, the constant defined by consult exists in the constant table, and the system allocates memory for it.

    2. The constants defined by define are only replaced directly during preprocessing, so the data type validation cannot be performed during compilation, and for the constants defined by const, strict type checking at compile time can avoid errors.

    3. Pay attention to the "edge effect" when defining expressions.

    For example: definen1+2;

    floata=n/;

    Conventionally, the result can be considered to be 3 2=;

    But in reality, the result should be 1+2;

    If you want to reach 3 2, define (1+2);

    In order to avoid edge effects, parentheses must be added.

  7. Anonymous users2024-02-09

    #include

    #define uns using namespace std;

    unsint main()

    cout<<"hello world""If the last std is not followed by a semicolon uns, a semicolon uns should be added;

  8. Anonymous users2024-02-08

    C++, in C++, the macro definition is defined in the form of the source define, and the macro definition contains the following.

    zhi This macro definition:

    The non-parametric macro defines the DAO without parameters after the macro name of the parametric macro.

    The general form of its definition is: define identifier string where the " " indicates that this is a preprocessing command. Anything that starts with " " is a preprocessing command.

    define" defines the command for the macro. Identifier is the name of the macro that you define. A "string" can be a constant, an expression, a string of formats, and so on.

    The definition of a symbolic constant, described earlier, is a parameterless macro definition. In addition, it is common to define macros for expressions that are used repeatedly in programs. For example:

    define m (y*y+3*y) It does this by specifying the identifier m in place of the expression (y*y+3*y). When writing the source program, all (y*y+3*y) can be replaced by m, and when compiling the source program, the preprocessor will first replace the macro, that is, replace all the macro names m with (y*y+3*y) expressions, and then compile it.

  9. Anonymous users2024-02-07

    When writing a program, it is often necessary to output through copy, such as printf, cout, and sometimes it is a bit troublesome when you want to output the value of the expression and the form of the expression in front of it! For example, cout<<"a*b(c-d):"<"Such expressions are too lazy to write, or many such expressions, which are also a waste of time to write, we can use " " to reduce the hassle!

  10. Anonymous users2024-02-06

    These macros are deleted when they are compiled, and they are nothing when they are compiled. Their meaning is simply to be able to write these things without causing compilation errors.

    This is a Microsoft thing called sal, source code annotation language, which has two functions: the first is to show people, clarify some ** meanings, such as whether the most common markup function parameters are used for output or input; The second is for analysis tools to detect syntax but logical errors.

  11. Anonymous users2024-02-05

    Simple macros like define pi and so on are generally defined as constants const double pi = ;

    Macros such as define (x) (x+2) are generally replaced by inline functions in C++ to ensure efficiency.

  12. Anonymous users2024-02-04

    You're talking about macro definitions in C, which are also precompiled instructions.

    First of all, you have written the macro definition incorrectly, ifnodef should be ifndef, engif should be endif

    Next, let's talk about the usage of these macro definitions.

    define: This macro definition is to use one name instead of another. For example, define age 5

    Then, in the program, fill in age, when precompiling, the compiler will automatically replace age with 5, note, this is a direct replacement, so if define x 3+1, then enter 5*x in the program, the compiler will replace it with 5*3+1, in this case it is generally defined as define x (3+1).

    ifdef, ifndef, endif: Generally ifdef ifndef and endif appear in pairs.

    As the name suggests, ifdef is if a certain macro is defined. Like what.

    ifdef age If you have defined age value (this is the value corresponding to age), execute the following statement.

    do something

    This concludes the endif execution statement.

    ifndef is the opposite of ifdef, which literally translates as if not define, that is, if a macro is not defined, the statement in if is executed. Such as:

    ifndef age If you didn't have a define age value (this is the value corresponding to age), execute the following statement.

    do something

    This concludes the endif execution statement.

  13. Anonymous users2024-02-03

    The words you wrote here are incorrect, if I'm not mistaken.

    It should be ifndef

    #define

    #endif

    There is no problem if you don't add it, simple programs will not report errors, but complex programs may cause problems.

    This is mainly used to solve the problem of duplicate header file inclusion and to prevent duplicate definition errors.

  14. Anonymous users2024-02-02

    If you don't add it, when you refer to it multiple times, it will cause you to define variables repeatedly.

    Header files are mainly declarations and implementations that define some common variables (global) or classes.

    If you don't know it, referencing each other between header files will cause duplicate references, resulting in errors.

  15. Anonymous users2024-02-01

    This is a precompile command.

    Specifically, as far as I know, multi-platform game engines will compile the resources of the corresponding platform separately through these commands.

Related questions
12 answers2024-08-07

define translates to definition in English;

define x >>>More

5 answers2024-08-07

The comprehensive fuel consumption of Changan Ruicheng CC should be about nine per 100 kilometers, which is a normal reference.

9 answers2024-08-07

1. Reset the window lift system

The window of the car can not be lifted is generally due to the battery power failure, the system disconnects the power supply or ground wire of the window control module when the vehicle is maintained, which can be solved by resetting the window lifting system, starting the car, controlling the switch of glass lifting, the glass continues to pull for more than 3 seconds after the glass rises to the top, release the switch and press and hold it immediately, initialize the lifting system of the window, if you are not sure, it is recommended to find professional technicians to deal with it. >>>More

18 answers2024-08-07

One: First of all, the problem of the game itself, your **game must be sure that someone is running successfully in progress**, don't blindly** The result is that there is a problem with the game itself, such an error is difficult to solve. >>>More

14 answers2024-08-07

It should be Elizabeth....It's a pity that it has the same name as the kind of person who has the heart of an uncle >>>More