C++:time()函数的返回值与它的参数有何关系,time(NULL)代表什么意思?
答案:2 悬赏:40
解决时间 2021-04-08 01:43
- 提问者网友:深爱及嗨
- 2021-04-07 14:19
C++:time()函数的返回值与它的参数有何关系,time(NULL)代表什么意思?
最佳答案
- 二级知识专家网友:浪者不回头
- 2021-04-07 14:48
Get the system time.time_t time( time_t *timer );
ParameterstimerPointer to the storage location for time.Return ValueReturn the time as seconds elapsed since midnight, January 1, 1970, or -1 in the case of an error.RemarksThe time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, Coordinated Universal Time (UTC), according to the system clock. The return value is stored in the location given by timer. This parameter may be NULL, in which case the return value is not stored.
ParameterstimerPointer to the storage location for time.Return ValueReturn the time as seconds elapsed since midnight, January 1, 1970, or -1 in the case of an error.RemarksThe time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970, Coordinated Universal Time (UTC), according to the system clock. The return value is stored in the location given by timer. This parameter may be NULL, in which case the return value is not stored.
全部回答
- 1楼网友:陪衬角色
- 2021-04-07 16:07
time是这样声明的:
time_t time( time_t *timer );
用法是你先自己定义一个time_t变量,让后把变量的地址传给它。函数会返回自1970年1月1日0点走过的秒数,同时把这个返回值保存在你传进来的那个time_t*指向的变量里面。如果你传进来null的话,就不保存。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯