+ 1

Macros

What data type is assigned to a macro? For example: Between "#define PI 3.14" and "const double PI=3.14;" we know that PI is of double data type in later but what about former?

6th Apr 2020, 4:56 AM
SURYA MUKILAN
SURYA MUKILAN - avatar
2 Respostas
+ 2
The macros can take function like arguments, the arguments are not checked for data type. For example, the following macro INCREMENT(x) can be used for x of any data type . #include <stdio.h> #define INCREMENT(x) ++x int main() {     char *ptr = "GeeksQuiz";     int x = 10;     printf("%s  ", INCREMENT(ptr));     printf("%d", INCREMENT(x));     return 0; } OUTPUT:eeksQuiz 11 Hope this might have helped you.
6th Apr 2020, 5:07 AM
Ayush Dwivedi
Ayush Dwivedi - avatar
0
Thanks Ayush!
6th Apr 2020, 5:16 AM
SURYA MUKILAN
SURYA MUKILAN - avatar