C Language Tutorials by Ghulam Murtaza Dahar - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Predefined Macro Value

__DATE__

String containing the current date

__FILE__

String containing the file name

__LINE__

Integer representing the current line number

__STDC__

If follows ANSI standard C, then value is a nonzero integer

__TIME__

String containing the current date.

How to use predefined Macros?

C Program to find the current time

#include <stdio.h>

int main(){

printf("Current time: %s",__TIME__); //calculate the current time

}