- C language
- preprocessor
- here
__LINE__ --line number
"__LINE__" is expanded by preprocessor to the line number of the line where "__LINE__" is written in the file where the source code is written.
__LINE__
Sample to get line number
#include <stdio.h> int main (void) { printf("%d\n", __LINE__); }
Output result.
Four
Sample to display an error message and exit the program
A sample that combines the exit function, __FILE__, and __LINE__ to display an error message and exit the program is exit function description.