Thursday, 3 May 2012

Q.  How to print current date in C?
    #include<stdio.h>
    int main()
    {
       printf("Current Date is =>  %s", __DATE__);  // remember its double underscore in DATE
       getch();
       return 0;
   }

 Also,
  #include<stdio.h>
    int main()
    {
       struct current_date d;
       getdate(&d);
       printf("Current Date is =>  %d-%d-%d",d.da_day, d.da_mon, d.da_year);
       getch();
       return 0;

   }

1 comment:

  1. Knowledge Sharing is good thing

    ReplyDelete