why the first loop of the function doesnt stop??
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct node node;
struct node{
int value;
struct node * next;
};
int countletters(char *str);
void main()
{
int g;
char * str="aabx bXcb bBxaDAa";
g=countletters(str);
}
int countletters(char *str)
{
char ch='a';
char *st;
int cnt=0;
for(st=str;st!='\0';st++)
{
if ((*str>='A')&&(*str<='Z'))
{
*str+=32;
}
}
for(;ch<='z';ch++)
{
for(st=str;st!='\0';st++)
{
if (*st==ch)
{
cnt++;
break;
}
}
}
return cnt;
}