C program to print the current date and time
kw.c
#include <stdio.h>
#include <time.h>
int main()
{
    time_t t;
    time(&t);
    printf("Current Date and Time is %s", ctime(&t));
    return 0;
}
Output
kodingwindow@kw:~$ gcc kw.c
kodingwindow@kw:~$ ./a.out Current Date and Time is Thu May 31 07:44:51 2018 kodingwindow@kw:~$
What Next?
C Pointers
Advertisement