Skip to content
Permalink
2ad88bb57b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
35 lines (30 sloc) 594 Bytes
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <string.h>
int processData(void){
printf("Please Enter Data >");
char data[32];
gets(data);
printf(data);
return 1;
}
int main(int argc, char *argv){
printf("Smash the Forking Stack\n");
while(1){
int pid = fork();
if(pid == 0){
//Child Deals with data
processData();
printf("Child Returns\n");
return 0;
}
else{
//Parent gets on with Life
printf("Parent Waits on Child\n");
wait(NULL);
}
}
}