Created
December 29, 2021 07:50
-
-
Save Rajssss/a7aab411bdc09f1cd3553b578bc64898 to your computer and use it in GitHub Desktop.
printf print line no and file name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/* redefine printf for the rest of file. */ | |
#define printf(...) \ | |
do { \ | |
printf("%s: %d:\t", __FILE__, __LINE__);\ | |
printf(__VA_ARGS__);\ | |
} while (0) | |
/* after this point, each call to printf will be replaced by two. */ | |
int main(void) | |
{ | |
printf("Hello\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment