Quote:
Buddy this is not my homework, I had taken part in an online competition but before that competition they give such questions
There will be probably a reason for such questions. They want to see if you have some skills (or show you if your skills are sufficient for the competition). But it does not care. CodeProject is not a code writing service.
Quote:
Just now can't getting the sorting, how to do that, just tell me that now.
That is rather rude and will not increase the chance to get an answer.
Anyway, to be back on topic and let this qualify as an answer:
Entering something like "c sort algorithm" into a search engine of your choice should point you to the C standard library function
qsort - C++ Reference[
^] (don't be irritated by the C++ in the link, it is about C).