#define 连接字符串

define连接字符串

  • define conn(x,y) x##y,连接x与y

  • define toString(x) #x,将x变成字符串

#include <stdio.h>
#define conn(x,y) x##y
#define toChar(x) #x

int
main(void)
{
        int a = conn(123,234);
        char* b = toChar(1);
        printf("%d", a);
        printf("%c", *b);

        return 0;
}

原文地址:https://www.cnblogs.com/cwhan/p/14807982.html