I just finished writing selection sort and after my code was done I tried to run the program. After I give the needle as a command-line argument and input a couple of straws, I press ctr+d and nothing happens. The program doesn't continue its normal behaviour it just freezes and it doesn't let me quit it so I have to close the current terminal window and open a new one. Any ideas where does that come from?

1 Answer 1


This has every indication of being an infinite loop somewhere after the code that takes in the data. Look in any loops that follow. There's also a chance that it's waiting for input without having written a prompt, but unlikely.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

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