Interview answers verified by specialists.

Find interview questions and answers on this website:

See right interview answers on 30 common job interview questions

What are the __DATE__ and __TIME__ preprocessor commands?

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 <stdio.h>
void main(void);
void print_version_info(void);
void main(void)
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.

Do you know that?

$49 average hourly rates for Graphic Designer freelance Next