Practical Use Cases
What are #ifdef and #ifndef
#define DEBUG_MODE
#ifdef DEBUG_MODE
printf("Debugging is enabled!\n");
#endif
#ifndef RELEASE_MODE
printf("Running in development mode.\n");
#endif
Error macro
Завдання
Swipe to start coding
- Use the necessary macro to check the existence of
PROTOCOL_TCPandPROTOCOL_UDP, and don't forget to properly close the necessary macro. - Use a macro to check the values of the
PROTOCOL_TCPandPROTOCOL_UDPmacros, and correctly close it. - Use a macro to check an additional condition.
- Use a macro to create an error message in case of an error.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 3
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
Can you explain the difference between #ifdef and #ifndef with more examples?
When should I use #error in my code?
What happens if I use #ifdef or #ifndef with a macro that is not defined?
Awesome!
Completion rate improved to 5.56
Practical Use Cases
Свайпніть щоб показати меню
What are #ifdef and #ifndef
#define DEBUG_MODE
#ifdef DEBUG_MODE
printf("Debugging is enabled!\n");
#endif
#ifndef RELEASE_MODE
printf("Running in development mode.\n");
#endif
Error macro
Завдання
Swipe to start coding
- Use the necessary macro to check the existence of
PROTOCOL_TCPandPROTOCOL_UDP, and don't forget to properly close the necessary macro. - Use a macro to check the values of the
PROTOCOL_TCPandPROTOCOL_UDPmacros, and correctly close it. - Use a macro to check an additional condition.
- Use a macro to create an error message in case of an error.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 3
single