Solution for Exercise 21-2
ex2102
#include <stdio.h>
#include <time.h>
int main()
{
time_t tictoc;
tictoc=time(NULL);
printf("The time is now %ld\n",tictoc);
return(0);
}
Output
The time is now 1589835271
Notes
* You have your choice of how to eat the value generated by time(). The function requires a pointer, so if you'd rather just take the time_t value returned, stick a NULL between the parentheses. Otherwise, you can specify the address of a time_t value. Don't let this flexibility confuse you.
Copyright © 1997-2025 by QPBC.
All rights reserved
