What's wrong with my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong with my code?

https://www.urionlinejudge.com.br/judge/en/problems/view/1042 This is the problem. But in my code, In the last part, printing the user's input is not happening. How to print it? https://code.sololearn.com/c8rwsCUaRFEv/?ref=app

31st Oct 2020, 8:00 PM
Samia Haque
Samia Haque - avatar
6 Answers
31st Oct 2020, 8:34 PM
Coding Cat
Coding Cat - avatar
+ 2
Coding CAT yes I just saw ordered numbers as output and thought it was fine 😁
31st Oct 2020, 8:43 PM
Davide
Davide - avatar
+ 1
Turbo C is obsolete. Things like <conio.h> and clrsrc doesn't work nowadays. Forget about turbo C and learn the language used today. If you delete #include <conio.h> and the line with clrsrc, the program works fine
31st Oct 2020, 8:23 PM
Davide
Davide - avatar
+ 1
I'm not sure. But I think, your Funktion call is a an call by reference. So your Parameter in this call is a pointer to the array. That's why you are sorting the values directly in the input array. Try to create a second array. Copy the input values in here. Use the first or second array for the sort funtion. And the other one for print out the user input. Maybe this should work.
31st Oct 2020, 8:26 PM
Coding Cat
Coding Cat - avatar
+ 1
Thank you Coding CAT 😃
31st Oct 2020, 8:54 PM
Samia Haque
Samia Haque - avatar
0
Davide You're right with this turbo c. But you haven'd read his task. His output is not fine. It should output the user input, but it doesn't 😉
31st Oct 2020, 8:40 PM
Coding Cat
Coding Cat - avatar