Examveda

What will be the output of the following C code if the system time is 1:52 PM (Sunday)?
#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,"%I",ptr);
    puts(str);
    return 0;
}

A. 13

B. 01

C. 1

D. error

Answer: Option B


This Question Belongs to C Program >> Standard Library Functions

Join The Discussion

Related Questions on Standard Library Functions