In addition, to printing an increasing number of exclamation points, the program should accept an integer as a command line argument. After the user presses Ctrl-C that many times, the program should exit.
In addition the line sleep(1); has the following error message: implicit declaration of function 'int sleep(...)'
Please advise.
Thanks.
Expand|Select|Wrap|Line Numbers
- #include <stdio.h>
- #include <signal.h>
- main()
- {
- void f(int);
- int i;
- signal( SIGINT, f );
- for(i=0; i<5; i++ ){
- printf("hello\n");
- sleep(1);
- }
- }
- void f(int signum)
- {
- printf("OUCH!\n");
- }