Function like macros
#include <stdio.h>
#define ONE 1
#define AND &&
#define OR ||
#define TWO ONE + ONE
#define THREE TWO + ONE
#define MESSAGE "we can extend \
the macro template by\
using back slash"
int main()
{
if (1 AND 1){printf("something true\n");}
printf("%d\n", TWO);;
printf("%d\n", THREE);
printf( MESSAGE);
return 0;
}
***********************************
#include <stdio.h>
#include <stdlib.h>
#define SQUARE(X,Y) X*Y
int main()
{int result = SQUARE (10, 12);
printf("%d \n" , result);
return 0;
}
Comments
Post a Comment