+ 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?
2 ответов
+ 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.
0
Thanks Ayush!