Examveda

What will be the output of the following C code if the system date is 6/2/2017 (Friday)?
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *ptr;
    time_t t;
    char str[100];
    t = time(NULL);
    ptr = localtime(&t);
    strftime(str,100,"%A",ptr);
    puts(str);
    return 0;
}

A. Error

B. Fri

C. Friday

D. 6

Answer: Option C


This Question Belongs to C Program >> Standard Library Functions

Join The Discussion

Related Questions on Standard Library Functions