I\'ve always been curious, why does the time(time_t *)
function both return a time_t
, and set the time to the passed in pointer?
Example of
It allows you to nest a call to time()
within another expression, instead of doing it in a separate statement:
time_t x = time(&now) + more_time;
When the above statement finishes, now
should contain the current time, and x
should contain the current time plus some value.
strcpy
falls in the same case because it returns the same char *
pointer that has been passed as its destination, so nesting it is possible as well:
printf("Copied string is %s", strcpy(dst, src));