How to sort unorganised integers in C language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to sort unorganised integers in C language?

13th Dec 2019, 2:26 PM
lamia
lamia - avatar
13 Answers
+ 3
Hey lamia I'm not getting you here, sort unorganised integers? did you mean the unorganised integers are in an array? but why in your recent comment you mention sort letters, are you sorting some integers or are you sorting characters in a C-string? * Just looking for clarity
13th Dec 2019, 2:42 PM
Ipang
+ 3
lamia If you want you can use qsort function, defined in stdlib.h header. You can of course opt to use one of the sorting algorithm available. Reference and example: http://www.cplusplus.com/reference/cstdlib/qsort/
13th Dec 2019, 2:58 PM
Ipang
+ 2
lamia, what type of sorting do you want to do. Can you give me an example Is it sorting an array like:- [3,4,2,1] to [1,2,3,4]? Or something else?
13th Dec 2019, 2:41 PM
Arsenic
Arsenic - avatar
+ 2
Roan Holloway I am just another guy who uses sololearn🙂🙃
13th Dec 2019, 2:44 PM
Arsenic
Arsenic - avatar
+ 2
Thanks Ipang . I needed this!!
13th Dec 2019, 3:00 PM
lamia
lamia - avatar
+ 2
You're welcome lamia Post that code up here when you're done 👌
13th Dec 2019, 3:04 PM
Ipang
+ 1
I have done it already...Arsenic The thing is: guess, with the help of scanf, i have inputted 5 numbers. 10 30 15 6 20 Now, i need to sort it. And make it 6 10 15 20 30. And same problem with array also. If the array is like {10,30, 20, 40} I need to make it {10, 20, 30, 40} Ipang
13th Dec 2019, 2:48 PM
lamia
lamia - avatar
0
I tried🙂. Need some clue. That's why I posted it.
13th Dec 2019, 2:30 PM
lamia
lamia - avatar
0
I have started with C language. Doing codes only with C. So, wanna sort numbers with the help of C. Anyway, people can be new in programming. What is "common sense" to you, that topic is maybe new to someone. behave good with people. God will bless you
13th Dec 2019, 2:36 PM
lamia
lamia - avatar
0
اهلا
14th Dec 2019, 2:38 PM
Abdo Ali
Abdo Ali - avatar
0
ممكن نتعرف
14th Dec 2019, 2:39 PM
Abdo Ali
Abdo Ali - avatar
0
H!
14th Dec 2019, 10:10 PM
DJ lightning
0
Unorganized integers in c language can be sorted out with various sorting techniques like bubble sort, merge sort etc. Bubble sort is most efficient in all of the techniques. You can decide yourself which technique you want to use.
15th Dec 2019, 6:11 AM
Roshni Bajpai