What are the__DATE__ and __TIME__ preprocessor commands? Ans. The __DATE__ macro is used to insert the current compilation date in the form 'mm dd yyyy' into your program. Similarly, the __TIME__ macro is used to insert the current compilation time in the form 'hh:mm:ss' into your program. This date-and-time-stamp feature should not be confused with the current system date and time. Rather, these two macros enable you to keep track of the date and time your program was last compiled. This feature can come in very handy when you are trying to track different versions of your program. For instance, many programmers like to put a function in their programs that gives compilation information as to when the current module was compiled. This task can be performed as shown here: #include void main(void); void print_version_info(void); void main(void) { print_version_info(); } void print_version_info(void) { printf('Date Compiled: %s\n', __DATE__); printf('Time Compiled: %s\n', __TIME__); } In this example, the function print_version_info() is used to show the date and time stamp of the last time this module was compiled. - Study24x7
Social learning Network
27 Mar 2023 11:55 AM study24x7 study24x7

What are the__DATE__ and __TIME__ preprocessor commands? Ans. The __DATE__ macro is used to insert the current compilation date in the form "mm dd yyyy" into your program. Similarly, the __TIME__ macro is used to insert the current compilation time in the form "hh:mm:ss" into yo...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles