#include <stdio.h>
#include <string.h>
#define pri(fmt, ...) printf(" --- "__FILE__" --- %s --- %d :" ,__FUNCTION__,__LINE__ );\
printf(fmt, ##__VA_ARGS__);\
printf("\n")
#define pri_mark() printf(" ____________ %s --- %s --- %d ! \n" ,__FILE__,__FUNCTION__,__LINE__ )
int main()
{
int i = 45;
int a = 23;
pri("%d",i);
pri_mark();
pri(" a : %d, i : %d ", a, i);
return 0;
}
运行结果:
--- test.c --- main --- 22 : 45
____________ test.c --- main --- 24 !
--- test.c --- main --- 26 : a : 23, i : 45
参考链接:
https://blog.csdn.net/weixin_42167759/article/details/81138469