What is the output of the below code?
#include <stdio.h>
void main()
{
printf("%d", __DATE__);
}
----------------------------------------------------------
The above tests below scenarios:
1. MACROS which are predefined in C
----------------------------------------------------------
We know that MACRO is a pre-processor directive in C programming. There are some macros which are predefined whose values cannot be modified. some of them are,
- __DATE__
- __LINE__
- __TIME__
- __STDC__
- __FILE__
In our code, __DATE__ is used which must prints system date. However, this is a character format and we have used %d as format specifier, so address shall be printed and not actual date. to print actual date, the printf statement must be,
printf("%s", __DATE__);
The current date as in "MMM DD YYYY" format shall be printed.
0 Comments