'C' compilers usually define preprocessor macros along with our header file inclusion macro. There are many different useful preprocessor macros available, two of them are __FILE__ & __LINE__.
__FILE__ -> will be replaced by the executing filename.
__LINE__ -> will be replaced by the current line of execution.
Example program - test.c:
1 #include
2
3 int main()
4 {
5 printf("\n%s\t%d",__FILE__, __LINE__);
6 return 0;
7 }
while running the above program outputs:
tst.c 5
__FILE__ -> will be replaced by the executing filename.
__LINE__ -> will be replaced by the current line of execution.
Example program - test.c:
1 #include
2
3 int main()
4 {
5 printf("\n%s\t%d",__FILE__, __LINE__);
6 return 0;
7 }
while running the above program outputs:
tst.c 5
No comments:
Post a Comment