Oct-16-2020, 05:27 PM
Why do you have a function definition inside other code? Usually you don't want to do that without a good reason because it's much harder to understand the flow of the program.
You've only put a snippet of your code above, and I don't think it's possible to tell what's happening. If the problem is in that function, write a small test program that calls it with number 1 smallest and show the output and explain why you think it should be doing something else.
Looks like that part of the code is working properly, (it exits when the first input is smaller), but then some other part of your code that you haven't shown starts it again.
You've only put a snippet of your code above, and I don't think it's possible to tell what's happening. If the problem is in that function, write a small test program that calls it with number 1 smallest and show the output and explain why you think it should be doing something else.
Looks like that part of the code is working properly, (it exits when the first input is smaller), but then some other part of your code that you haven't shown starts it again.