Using qsort() To Sort An Array | C Programming Example

preview_player
Показать описание


Other relevant videos to help understand what's happening with the comparison function...

Рекомендации по теме
Комментарии
Автор

The compare function is so well explained.

AfifaSadiq
Автор

I still dont get how qsort works with the x and y, does it iterate in the loop assigning a digit x and its successor y?

ongayijohnian
Автор

you explained this so much better than my prof. prof puts me to sleep.

idkzsh
Автор

So basically, if I understood correctly, the 4th argument of qsort is a function pointer returning an int, which is very interesting if this is the case. Function pointers are powerful and I would like to know more about their use in practice. Thank you.

gammyhorse
Автор

thank you, a clear, easy to understand tutorial!

madmademoiselle
Автор

does the compare function has to take const void pointer as parameters? or could it also take another type like const int pointer, so we don't need to use pointer magic and keep the code a bit more simple?

ismbks
Автор

thanks from russia, first video about comparator that i found

decumon
Автор

great video
so if we want to use it with array of structures instead of integer array; how exaclty will the casting be done i m a bit confused

akshatkhatri
Автор

I don't get how the compare function works without giving any arguments. I mean you say, we assume the numbers "2" and "5" from the array, but how is this actually working in the function without explicitly giving any arguments for the function?

philipphortnagl
Автор

have you created a same video for sorting structs?

kianoushmehrandish
Автор

Hmm why when you read the array and call qsort you can know is 2-7 but not 7-2 ur because you read the array from a[0] not form the last p/s : sorry if my english is bad

nguyentuan-efhr
Автор

i am trying to sort ' ' ' float array[5]= {11.1f, 11.34f, 11.22f, 11.99f, 11.00f}; ' ' ' it won't work in qsort why? any solution if i want to sort float using qsort?

varaddeshmukh