C语言如何比较时间的大小?

最好有例子。。。。我问的是如何比较时间的大小,不是获取系统时间
2026年09月25日 00:17
有2个网友回答
网友(1):

用字符串比较函数strcmp()

#include
#include"string.h"
void main()
{
int n;
n=strcmp("2010-04-30","2010-05-02");//再根据n进行判断
printf("%d",n);
}

网友(2):

time.h中定义了time_t这种数据类型(实际就是long),在time.h中定义一些函数可以取系统时间