Skip to content

Commit 9630d18

Browse files
committed
Using predefined macros
1 parent 26c7ee7 commit 9630d18

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <stdio.h>
2+
3+
/* ==============================================================
4+
Good practice: Feel free to use the following predefined macros
5+
__FILE__ : stands for the name (string %s) of the current file
6+
__LINE__ : stands for the line number (integer %d) where it executes
7+
__func__ : stands for the name of the function in whose body it is placed (string %s)
8+
__DATE__ : stands for the date when the file was compiled last time (string %s)
9+
__TIME__ : stands for the time when the file was compiled last time (string %s)
10+
__STDC__ : stands for 1 is standard compiler implementation was used , or 0 if a non standard compiler was used (integer %d)
11+
================================================================= */
12+
13+
void my_personal_function(void)
14+
{
15+
printf("This is the name of the function being executed at this moment \"%s\" \n",__func__);
16+
}
17+
18+
19+
int main(void)
20+
{
21+
printf("This file was last time compiled on %s and at time %s.\n",__DATE__,__TIME__);
22+
23+
printf("The name of this file is %s and currently it runs the line %d.\n",__FILE__,__LINE__);
24+
25+
if(__STDC__==1)
26+
{
27+
puts("Great news. This program was compiled using a compiler compliant with ISO C");
28+
}
29+
else
30+
{
31+
puts("Bad luck. This program was compiled using a compiler non-ISO compliant version of C");
32+
}
33+
34+
my_personal_function();
35+
36+
return 0;
37+
}

0 commit comments

Comments
 (0)