Cancel Macro
The #undef directive in the C programming language is used to undefine a previously declared macro created using the #define directive.
#undef <name_of_macro>
This allows you to remove a macro from the current scope so that its name can be redefined or no longer used in your program.
Macros are global: Macros operate at the preprocessor level, and their scope extends to the entire file where they are defined. Once redefined, the new value will be used wherever that macro appears later in the code.
main.c
1234567891011#include <stdio.h> #define MAX 100 int main() { printf("MAX = %d\n", MAX); // MAX = 100 #undef MAX // remove macros MAX #define MAX 200 // define new macros MAX printf("MAX = %d\n", MAX); // MAX = 200 return 0; }
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Resumir este capítulo
Explicar o código em file
Explicar por que file não resolve a tarefa
Awesome!
Completion rate improved to 5.56
Cancel Macro
Deslize para mostrar o menu
The #undef directive in the C programming language is used to undefine a previously declared macro created using the #define directive.
#undef <name_of_macro>
This allows you to remove a macro from the current scope so that its name can be redefined or no longer used in your program.
Macros are global: Macros operate at the preprocessor level, and their scope extends to the entire file where they are defined. Once redefined, the new value will be used wherever that macro appears later in the code.
main.c
1234567891011#include <stdio.h> #define MAX 100 int main() { printf("MAX = %d\n", MAX); // MAX = 100 #undef MAX // remove macros MAX #define MAX 200 // define new macros MAX printf("MAX = %d\n", MAX); // MAX = 200 return 0; }
Obrigado pelo seu feedback!
Awesome!
Completion rate improved to 5.56single