如何在printf中显示我的源代码的行号

How to display the line number of my source code in printf

本文关键字:源代码 我的 显示 printf      更新时间:2023-10-16

可能的重复:
C/C 线号

我想显示触发printf的行号?

看起来像这样:

printf("the line number is: %d",SOME_LIBC_MACRO);

如何做?

使用__LINE__

printf("the line number is: %d", __LINE__);

其他预定型宏的列表可用于GCC和Visual Studio

相关文章: