ANSI C CPP symbols and program to demonstrate it
Answer
ANSI C defines a set of C processor(CPP) symbols, which may be used in user programs. These symbols are
assigned actual values at compilation time.
cpp SYMBOL | USE |
---|---|
_STDC_ | Feature test macro. Value is 1 if a compiler is ANSI C, 0 otherwise |
_LINE_ | Evaluated to the physical line number of a source file. |
_FILE_ | Value is the file name of a module that contains this symbol. |
_DATE_ | Value is the date that a module containing this symbol is compiled. |
_TIME_ | value is the time that a module containing this symbol is compiled. |
test_ansi_c.c program illustrates the use of the above symbols: |
---|
#include<stdio.h> int main() { #if _STDC_==0 printf(“cc is not ANSI C compliant”); #else printf(“%s compiled at %s:%s. This statement is at line %d\n”, _FILE_ , _DATE_ , _TIME_ , _LINE_ ); #endif Return 0; } |
No comments:
For Query and doubts!