Programs find.c and generate.c work properly when ran standalone. And find.c also passes the check50. however when trying to combine generate and find as in ./generate x x | ./find x the program starts but gets stuck while sorting the numbers. Does anybody have an idea how that is possible?

  • By "stuck" do you mean an infinite loop ?
    – Quevun
    Mar 1, 2015 at 7:55
  • No not really, it just stops processing i guess. When running stand alone and printing the sorting process everything works fine. However, when combining with generate the sorting loop just pauzes in the middle of printing one of the numbers. (ie. it shows 10 20 30 4 followed by a blinking cursor).
    – Mihaly
    Mar 1, 2015 at 12:47
  • More interestingly, it works fine if a search a 5 digit number, but otherwise it gets stuck. so using ./generate 5 2 | ./find 20312 works, but ./generate 5 2 | ./find 2012 doesn't
    – Mihaly
    Mar 1, 2015 at 12:58
  • Can you post your code for helpers.c ?
    – Quevun
    Mar 1, 2015 at 13:29

1 Answer 1


Your program is indeed stuck in an infinite loop, using the condition middle!=upper is not a good idea since middle may never be equal to upper in your program.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .