I need to use the function g_array_sort(GArray *array, GCompareFunc *func) but I do not understand the second parameter.
Please show me how it should be called and if possible please attach a sample example….
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is an open source library, so you could take a look at the code of
g_array_sort()itself. Just type in g_array_sort into Google’s code search and you’ll get the code.There you can see that this function actually calls libc’s qsort(3) and passes the function you are interested in to qsort unchanged.
Now, Linux’s qsort man page has a good example of qsort use.