0

time() function

Why is its operand 0 ? Can it have any other operand?

24th May 2017, 6:55 AM
Mystique
Mystique - avatar
3 Respuestas
+ 5
see here: http://www.cplusplus.com/reference/ctime/ Basically it has two functions. The first is to return the current system time. The second is it can give this returned time to an object of type time_t such as time_t myTimer; time(&myTimer); We use 0 to tell it not to assign the time anywhere but just return it.
24th May 2017, 7:10 AM
jay
jay - avatar
+ 2
Like jay explained, this 0 is here simply to make the time function return to nothing... Basically 0 represents NULL here, to make the function pass the value to a null pointer which has no memory...
26th May 2017, 5:13 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 1
Thanks!
27th May 2017, 9:05 AM
Mystique
Mystique - avatar