C examples for Preprocessor:Macro
Create function to substitute value in string with macro
#include <stdio.h> #define PSQR(x) printf("The square of " #x " is %d.\n",((x)*(x))) int main(void){ int y = 5;/* w ww. j a v a 2 s . co m*/ PSQR(y); PSQR(2 + 4); return 0; }