Create a C program that forks itself. * * One part will ask the user to enter a number. * The program will then use a pipe to pass that number to the copy of * itself that is running. * * The copy will then add 1 to the number that it has been passed. * It will then pass the number back to the original program. * * The original program will then print out the number that it has * received. * * Run this program for the following inputs: 500, -1, 7 #include #include #include // Provides definition of "fork" int main(void) { return 0; }
AHPA #13 - The Adding Machine
*
* You have decided that what the world needs is a better adding machine * and gosh darn it, you are going to create it!
*
* Create a C
*
* One part will ask the user to enter a number.
* The program will then use a pipe to pass that number to the copy of
* itself that is running.
*
* The copy will then add 1 to the number that it has been passed.
* It will then pass the number back to the original program.
*
* The original program will then print out the number that it has
* received.
*
* Run this program for the following inputs: 500, -1, 7
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h> // Provides definition of "fork"
int main(void) {
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 6 images