Skip to content

Commit

Permalink
fixes smuos#7 Wait for child again. Just learned of smart commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyymmoT committed Sep 25, 2014
1 parent 515d4f0 commit adb6eb6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ int main(int argc, char *argv[]) {
// Sort numbers
qsort(pt, length, sizeof(int), numcmp);

// Print out numbers
fprintf(stdout, "%s: Sorted output is: \n", argv[0]);
for (i=0; i<length; i++) {
fprintf(stdout, "%d ", pt[i]);
}

//fork()
int rc = fork();

Expand All @@ -90,9 +84,14 @@ int main(int argc, char *argv[]) {
else if(rc == 0)
{
//child
fprintf(stdout, "%s: Sorted output is: \n", argv[0]);
for (i=0; i<length; i++)
{
fprintf(stdout, "%d ", pt[i]);
}
fprintf(stdout, "\nThis is the median: %d ", median(pt, length));
}

else if (rc > 0)
{
//parent
Expand Down

0 comments on commit adb6eb6

Please sign in to comment.