Write a C program called even.c that takes the input parameter n and prints the first n
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a C program called even.c that takes the input parameter n and prints the first “n” even numbers. We want the program to run slowly, so that it executes long enough to receive a signal. To achieve this, you should place a sleep(5) after every print statement. Compile and run to test it works ok.
Most Unix systems will understand SIGHUP and SIGINT. Every signal has a default action associated with it, for example the default action for SIGINT is to terminate the process.
You should modify your even number program to handle the signals as follows:
- When it receives a HUP signal, it should print "Ouch!" and continue.
- When it receives a INT signal, it should print "Yeah!" and continue.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: