2014年11月23日 星期日

巨集函數加上#、##

巨集函數加上#、##的使用方法


example

test.h
#define name_jeffery 100

test.c
#include "test.h"
#define abc(tset) { #test, name_##test}


main(){
  abc(jeffery);
}

執行結果如下

abc{ "jeffery" , name_jeffery}

由此可知#為字串##為跟隨在文字後面




沒有留言:

張貼留言