Examveda

What will be the output of the following C code if the system time is 4:27 PM?
#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,"%H %p %M minutes",ptr);
    puts(str);
    return 0;
}

A. 16 27 minutes

B. 4 27 minutes

C. 16 PM 27 minutes

D. 4 PM 27 minutes

Answer: Option C


This Question Belongs to C Program >> Standard Library Functions

Join The Discussion

Related Questions on Standard Library Functions