From e4abe0f130aeb7752ac3d33c4f7974569f7eccdf Mon Sep 17 00:00:00 2001 From: Xujie Zheng Date: Thu, 25 Sep 2014 20:13:45 -0300 Subject: [PATCH] fixed #4 & fixed #5 & fixed #6 & fixed #7 --- mm.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mm.c b/mm.c index 98d60ae..1147342 100644 --- a/mm.c +++ b/mm.c @@ -83,12 +83,24 @@ int main(int argc, char *argv[]) { qsort(pt, length, sizeof(int), numcmp); // Print out numbers - fprintf(stdout, "%s: Sorted output is: \n", argv[0]); + fprintf(stdout, "%s: Sorted output is: \n", argv[0]); for (i=0; i 0) { + int wc = wait(NULL); //waiting for the child process to end + fprintf(stdout, "this is the parent(pid:%d) and I was waitting for process %d to end,\nand also my child pid is %d",(int) getpid(),(int) wc,(int) rc); + fprintf(stdout, " the mean is %d\n", mean(pt,length)); + fprintf(stdout, "%s: FIN.\n", argv[0]); + } + return 0; }