Complete the code to print the current line number using a predefined macro.
#include <stdio.h> int main() { printf("Line number: %d\n", [1]); return 0; }
The __LINE__ macro expands to the current line number in the source file.
Complete the code to print the current file name using a predefined macro.
#include <stdio.h> int main() { printf("File name: %s\n", [1]); return 0; }
The __FILE__ macro expands to the current source file name as a string.
Fix the error in the code to print the compilation date using a predefined macro.
#include <stdio.h> int main() { printf("Compiled on: %s\n", [1]); return 0; }
The __DATE__ macro expands to the compilation date as a string.
Fill both blanks to print the compilation date and time using predefined macros.
#include <stdio.h> int main() { printf("Compiled on: %s at %s\n", [1], [2]); return 0; }
__DATE__ gives the compilation date and __TIME__ gives the compilation time.
Fill all three blanks to print the file name, line number, and compilation time using predefined macros.
#include <stdio.h> int main() { printf("File: %s, Line: %d, Time: %s\n", [1], [2], [3]); return 0; }
__FILE__ gives the file name, __LINE__ the line number, and __TIME__ the compilation time.