What will be the output of the following C code if the system time is 1:52 PM (Sunday)?
Posted: Wed Jul 13, 2022 7:56 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,"%I",ptr);
puts(str);
return 0;
}
a) 13
b) 01
c) 1
d) error
#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