title: Sort data in C language
body: <p>I need little help on following requirement, as I know very little about C syntax.</p>
  
  <p>I have data in a file like this</p>
  
  <pre><code>73 54 57 [52]
  75 73 65 [23]
  65 54 57 [22]
  22 59 71 [12]
  22 28 54 [2]
  65 22 54 73 [12]
  65 28 54 73 [52]
  22 28 65 73 [42]
  65 54 57 73 [22]
  22 28 54 73 [4]
  </code></pre>
  
  <p>Where values in bracket denotes the occurrence of that series. I need to sort this data based on the occurrence of the data descending with maximum elements on the top as follows.</p>
  
  <pre><code>65 28 54 73 [52]
  22 28 65 73 [42]
  65 54 57 73 [22]
  65 22 54 73 [12]
  22 28 54 73 [4]
  28 59 71 [122]
  73 54 57 [52]
  22 28 65 [26]
  ..
  .
  .
  .
  </code></pre>
  
  <p>And so on...</p>
  
  <p>What is a quick code for this?</p>
  
  <p>I am trying this</p>
  
  <pre><code>#include&lt;string.h&gt;
  #include &lt;stdio.h&gt;
  int main() {
  
      FILE *infile;
      char fname[40]="resultFile1.txt";
      char line[100];
      int lcount=0;
      if((infile = fopen(fname, "r")) == NULL) {
          printf("Error Opening File.\n");
      }
      char *Arr[23];// need to be dynamic
      while( fgets(line, sizeof(line), infile) != NULL ) {
          stringArray[lcount]=line;
          lcount++;
          Arr[lcount]=line;
      } fclose(infile);
      int i;
      for (i = 0; i &lt; lcount; i++) {
          printf(Arr[i]);// not able to get Arr
      }
  }
  </code></pre>