/* saves file name and current line in a string and prints it on the screen*/
#include <stdio.h>
int main(void) {
/* note the use of a marco to save the line nr. */
int line_n= __LINE__;
/* note the use of a marco to save the file name */
char file_name[]= __FILE__;
/* Some text you wish to print/save */
char line[] = "Line ";
char file[]= " of file ";
char my_str[100];
/* expand everything and save it in my_str for future use */
sprintf(my_str, "%s%d%s%s", line, line_n, file, file_name);
/* or just print it out on the screen */
printf("%s", my_str);
return 0;
}