I need help with sorting a simple structure please
In my program I have an array of the structure CD. (shown below). I am a beginner and I'm having difficultly writing a basic sorting function which will rearrange the 5 CD structures using the 'MNumber' member.
I understand that I may need to make a temporary copy of my array of structures so that the 'swaping' can occur and the arrays can be placed ascending order based on the 'MNumber' member. I know it's not a lengthly piece of code to do this, but my attempts have been unsucessful. Can anyone help? I'd really appreciate it!
struct
{
char MTitle[50];
int MNumber;
} CD[5];