Predefined Macro Names - C Preprocessor

C examples for Preprocessor:Macro

Introduction

C specifies five built-in predefined macro names. They are

__LINE__
__FILE__
__DATE__
__TIME__
__STDC__

The __LINE__ and __FILE__ macros contain the current line number and filename of the program when it is being compiled.

The __DATE__ macro contains a string of the form month/day/year when the source file is compiled into object code.

The __TIME__ macro contains the time in form of hour:minute:second at which the program was compiled.

If __STDC__ is defined as 1, then the compiler conforms to Standard C.

C99 also defines these two macros:

__STDC_HOSTED__
__STDC_VERSION__

__STDC_HOSTED__ is 1 for environments in which an operating system is present and 0 otherwise.

__STDC_VERSION__ will be at least 199901 and will be increased with each new version of C.


Related Tutorials