Tuesday, June 9, 2009

C preprocessor use for replace string by '##'

C preprocessor allow us to replace string by putting '##' on variable

eg.

#include "stdio.h"

void func_replace(){printf("func_replace is called\n");}

#define REPLACE_FUNC(A) func_##A()

void main()
{
/*func_replace will be invoked*/
REPLACE_FUNC(replace);
}

No comments: