A macro may be used in the definition of another macro as illustrated below.
#define A(x) x*x
#define cost(A,y) A*y
Program illustrates this concept. In this program, Area is a function of x, and the cost of painting the area is defined as a function of area in the macro definition.
#include<stdio.h> #define Area(x) x*x #define Costpaint(x,y,z) (z*y + Area (x)) void main() { int A = 8, B= 6, C = 4; clrscr(); printf("The area of square= %d\n", Area(A)); printf("Cost of paint= %d\n", Costpaint(A,B,C)); }