0

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?

5
  • By "stuck" do you mean an infinite loop ?
    – Quevun
    Commented 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
    Commented 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
    Commented Mar 1, 2015 at 12:58
  • Can you post your code for helpers.c ?
    – Quevun
    Commented Mar 1, 2015 at 13:29
  • gist.github.com/anonymous/ae432b578f3dae049c98
    – Mihaly
    Commented Mar 1, 2015 at 15:19

1 Answer 1

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 .