函数重定向

#include "stdio.h"
#include "stdlib.h"

#define AAAA
#define BBBB

#ifdef AAAA
extern int test1(void);
extern int test2(void);
#ifdef BBBB
    #define test test1
#else
    #define test test2
    #endif
#endif


int main(void)
{
/***************************************************************/
test();
/***************************************************************/
system("pause");
return 0;

}

/******************************************************************************************************************************/

#include "stdio.h"
#include "stdlib.h"
int test1(void)
{
printf("yangchaofeng add test  1111\n");
return 0;
}
int test2(void)
{
printf("yangchaofeng add test   2222\n");
return 1;
}

/******************************************************************************************************************************/

猜你喜欢

转载自blog.csdn.net/yangchaofeng001/article/details/46445563