So the idea is I will input 10 numbers and the program will arrange it into ascending order. I know I have to use arrays and for loops. I just don't know how to apply it. I need help with this one. I'll check back here when I finish the code I'm working on then post it here and see if anyone decides to help me with this.
Should the user be able to enter in numbers higher than 9? How about negative values?
un-Time Check Failure #2 - Stack around the variable 'num_outpt' was corrupted.
This error is probably due to this else statement:
1 2 3 4
else
{
num_outpt[i++]=num[i]; //Here we can try to access element i[10] on iteration 9 of the for loop.
}
Why is that else statement there? It means that if the user enters a value of 10 or more, the next position in the array becomes that value, which is then immediately over-written with the next choice, or is writing out of bounds of the array.
Hello @sanasuke15
I have a different approach,
to solve this problem, using
functional decomposition and
const variable instead of #define MAX_VALUE 10
check this example and tell me what you think.