Answered step by step
Verified Expert Solution
Question
1 Approved Answer
debugg hw 2 _ q 9 . c: In function 'main': hw 2 _ q 9 . c: 2 2 : 1 1 : warning:
debugg
hwqc: In function 'main':
hwqc::: warning: missing terminating character
printf Process d failed to fork!
getpid;
hwqc::: error: missing terminating character
printf Process d failed to fork!
getpid;
hwqc::: error: expected expression before 'return'
return ;
hwqc::: error: expected before
code:
WaitChildc
#include
#include
#include
int main
pidt pid;
int status;
pid fork;
if pid
printf I am process d getpid ;
printf and my parent is d
getppid ;
else if pid
printf I am parent d getpid ;
printf and my child is d
pid;
else
printf Process d failed to fork!
getpid;
return ;
printf I am process d
getpid;
if pid
sleep ; sleep seconds
printf I am process d getpid;
printf and I quit.
;
else
printf I am parent d getpid;
printf and Im waiting for child d
pid;
wait&status;
printf I am parent d getpid;
printf and my child d pid;
printf has arrived. I quit too.
;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started