I\'m just wondering whether is it possible and how do I implement this feature, where we exit from the loop if there\'s no input from the user. For example, I want to exit t
Although the time_t structure returned by time() is most likely a number of seconds, you should not be performing maths on it. Instead use difftime()
double difftime ( time_t time2, time_t time1 );
Calculates the difference in seconds between time1 and time2.
You do not need to call main()
from within main()
and I'm not sure why you would think that is a good idea.
Also, getchar()
will wait for a key to be pressed, so it won't be counting time in the background.