+ 2

What are Macros in C?

19th May 2020, 6:24 AM
__The__True__Villain__
__The__True__Villain__ - avatar
2 Réponses
+ 4
Macros in C are string replacements commonly used to define constants. ... Basically macros are one of the Preprocessor directives available in C. Macro substitution is a process where an identifier in a program is replaced by a predefined string.
19th May 2020, 6:38 AM
Ayudh Abhale
+ 1
A 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 Macros Function-like Macros Object-like Macros The 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 Macros The function-like macro looks like function call. For example: #define MIN(a,b) ((a)<(b)?(a):(b))
19th May 2020, 9:06 AM
Kamal
Kamal - avatar