C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C MacrosA macro is a segment of code which is replaced by the value of macro. Macro is defined by #define directive. There are two types of macros:
Object-like MacrosThe object-like macro is an identifier that is replaced by value. It is widely used to represent numeric constants. For example: #define PI 3.14 Here, PI is the macro name which will be replaced by the value 3.14. Function-like MacrosThe function-like macro looks like function call. For example: #define MIN(a,b) ((a)<(b)?(a):(b)) Here, MIN is the macro name. Visit #define to see the full example of object-like and function-like macros. C Predefined MacrosANSI C defines many predefined macros that can be used in c program.
C predefined macros exampleFile: simple.c #include Output: File :simple.c Date :Dec 6 2015 Time :12:28:46 Line :6 STDC :1
Next TopicC #include
|