Solution for Exercise 21-3

ex2103

#include <stdio.h>
#include <time.h>

int main()
{
    time_t tictoc;

    time(&tictoc);
    printf("The time is now %ld\n",tictoc);
    time(&tictoc);
    printf("The time is now %ld\n",tictoc);
    return(0);
}

Notes

* Here's the output I saw:

* Obviously my computer is too fast. Back in the old days, say 20 years ago, you might actually see different values.

* If you'd like to modify the code further, you could place a getchar() statement that would definitely pause the output. The two time values would be different if that were the case.