What is the meaning of the following C code if output is 0? [code]#include<stdio.h> #include<time.h> int main() { struct tm *local;

Nam Phong

New member
What is the meaning of the following C code if output is 0?
Code:
#include<stdio.h>
#include<time.h>
int main()
{
    struct tm *local;
    time_t t;
    t=time(NULL);
    local=localtime(&t);
    printf("%d",local->tm_isdst);
    return 0;
}
A. DST is in effect
B. DST status is unknown
C. DST is not in effect
D. DST is corresponding with local time
 
Answer: c
Explanation: Daylight Savings time is in effect when the value of tm_isdt is 1. It is not in effect when the value of tm_isdst is 0 and it’s status is unknown when the value of tm_isdst is -1.
 

Tìm kiếm

Back
Top