在C++中,有
#define DEBUG(A) cerr << (A) << endl;我可以向它发送任何东西,它也可以打印出来。然而,在C中,我必须用%d,%c或%s等来指定它的类型。但我不想一直写它的类型,我想像cerr一样使用fprintf。我该怎么做呢?
例如:在C中
#define DEBUG(A) X // X is what I want to write
...
// in function, when I put
DEBUG(5); // I just want to print 5
// or, with same statement, when I say
DEBUG('a'); // output : ahttps://stackoverflow.com/questions/5469464
复制相似问题