title: Function that counts chars in a string in C
body: <p>I am new a C. I would like to get help to finish my function.</p>
  
  <p>The mission is:</p>
  
  <p>Write a function that accepts a string <code>maximum length of 256 characters containing characters from 'a' to 'z'</code>.</p>
  
  <p>The function to print the number of occurrences of each character.</p>
  
  <p>For example: input <code>abba</code> output will be:</p>
  
  <pre><code>a = 2 b = 2 c = 0 d = 0 .... z = 0
  </code></pre>
  
  <p>Do not use if during any function.</p>
  
  <p>I would like to get your help to finish this program please.</p>
  
  <p>This is my code</p>
  
  <pre><code>#include "stdlib.h"
  #include "conio.h"
  #include "stdio.h"
  #include "string.h"
  #define size 256
  
  
  
  void repeat(char *str);
  void main()
  {
      char str[size];
      printf("Please enter a string:\n");
      flushall;
      gets(str);
      repeat(str);
      system("pause");
      return ;
  }
  void repeat(char *str)
  {
  
      char temp=strlen(str);
      int i, count=0;
      do
      {
      for (i=0; i&lt;temp ; i++)
          {
              count += (*str == str[temp-i]);
          }
      printf("Char %c appears %d times\n ",*str,count);
      count=0;
      }
      while(*(str++));
  }
  
  
  
      Please enter a string:
  abbba
  Char a appears 1 times
   Char b appears 2 times
   Char b appears 1 times
   Char b appears 0 times
   Char a appears 0 times
   Char   appears 0 times
   Press any key to continue . . .
  </code></pre>
  
  <p>this is the output!
  I would like to do it in the same building i did.
  and should be like
  Char a appears 2 times
  Chars b appears 3 times</p>