Oh, thanks. I made my own little program out of this..:
Code:
#include <stdio.h>
#include <conio.h>
int count_char(char* str, char needle);
int main()
{
char *line, letter;
printf("Count what letter? ");
letter=getche();
printf("\r\nIn what string? ");
gets(line);
printf("You typed '%c' %d times.", letter, count_char(line, letter));
return 0;
}
int count_char(char* str, char needle)
{
int count = 0;
while(*str)
{
if(*str == needle)
count++;
str++;
}
return count;
} But i dont understand the count_char() function

.. would you mind explaining it?