C program to print the line number in source code with filename and function name
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
In this program, we will print the line number in the source code using __LINE__ macro on the console screen.
Here, we will use three macros, __LINE__, __FUNCTION__, and __FILE__.
Program:
The source code to print the line number in the source code with filename and function name is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
Output:
Explanation:
In the main() function, we printed the line number with filename and function name using __LINE__, __FILE__, and __FUNCTION__ macros on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer