Kim Lillåsowningmymistakes.hashnode.dev·Feb 7, 2024Careful about function-like macro parameter namingI needed to create a function-like macro which set a parameter in a default settings struct, simple enough. struct Settings { unsigned enabled; }; struct Settings defaultSettings; #define SetEnabled(enabled) (defaultSettings.enabled = enabled) ...DiscussC++
Jyotiprakash Mishrablog.jyotiprakash.org·Dec 24, 2023#define should be used more oftenThe #define directive in C is used for creating macros, constants, and inline functions. Let's go through examples of each: Constants using #define: Defining a constant using #define. #include <stdio.h> // Define a constant #define ...Discussdefine