title: C, Showing count of repeating symbols
body: <p>Need to figure out a code that counts all the repeating symbols in a string. As you can see below, so far so good.</p>
  
  <p>And here starts the tricky part, at the end of the code I want to output symbols in an order they were typed which had for example 2 occurences in a string, and I got problems figuring that out.</p>
  
  <pre><code>int counts[256] = { 0 };
  
  int i;
  size = strlen(text);
  
  for (i = 0; i &lt; size; i++) {
  counts[(int)(text[i])]++;
  }
  
  for (i = 0; i &lt; 256; i++) {
  printf("The %d. character has %d occurrences.\n", i, counts[i]);
  }
  </code></pre>