What is time(NULL) in C?

后端 未结 8 1054
别跟我提以往
别跟我提以往 2020-12-07 19:12

I learning about some basic C functions and have encountered time(NULL) in some manuals.

What exactly does this mean?

8条回答
  •  囚心锁ツ
    2020-12-07 19:56

    You can pass in a pointer to a time_t object that time will fill up with the current time (and the return value is the same one that you pointed to). If you pass in NULL, it just ignores it and merely returns a new time_t object that represents the current time.

    Nb:time(&timer); is equivalent to timer = time(NULL);

提交回复
热议问题