title: Sorting an array of structures in C
body: <p>Let's say I have structure like this:</p>
  
  <pre><code>typedef struct MyStruct{
    char *string1;
    int number1, number2, number3;
    char string2[11], string3[9];
    char *string4;
    char *string5;
  }MyStruct;
  </code></pre>
  
  <p>Programs prompts user to choose by what field it should sort the data. I am having trouble thinking of a way to sort array effectively. Do I really need to write separate sorting functions for each field? There must be some other way, because writing 8 functions, where 2 would suffice, doesn't look rational.</p>