Sams Teach Yourself C in 21 Days

(singke) #1

TYPE& RUN 3 Pausing for a Second or Two


This is the third Type & Run section. Remember, the purpose of the listings in
the Type & Run sections is to give you something a little more functional than
what you are getting in the daily lessons. This listing contains only a few ele-
ments not already explained, thus making it an easy listing to follow. After you
type in and run this program, take the time to experiment with the code. Make
changes, recompile, and then rerun the program and see what happens. If you
get any errors, make sure you entered the program correctly.

LISTINGT&R 3 seconds.c. A program with a sleep function
1: /* seconds.c */
2: /* Program that pauses. */
3:
4: #include <stdio.h>
5: #include <stdlib.h>
6: #include <time.h>
7:
8: void sleep( int nbr_seconds );
9:

16 448201x-T&R3 8/13/02 11:16 AM Page 219

Free download pdf