I am writing a C program that's supposed to take a char array and then count all the lowercase letters in it, all the uppercase letters in it as well as all the vowels. For some reason though, it's not running because the compiler returns a segmentation fault. I don't know what it is and I don't know where the problem is
#include <stdio.h>
int lccount(char x[10]){
int count=0,i,j;
char lowalphabet[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
for(i=0;i<=10;i++){
for(j=0;j<=26;j++){
if(x[i]==lowalphabet[j]){
count++;
}
}
}
return count;}
int uccount(char x[10]){
int count=0,i,j;
char upalphabet[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
for(i=0;i<=10;i++){
for(j=0;j<=26;j++){
if(x[i]==upalphabet[j]){
count++;
}
}
}
return count;}
int vcount(char x[10]){
int count=0,i,j;
char vowels[]={'a','e','i','o','u','A','E','I','O','U'};
for(i=0;i<=20;i++){
for(j=0;j<=10;j++){
if(x[i]==vowels[j]){
count++;
}
}
}
return count;
}
void main(){
char x[10]={'a','W','E','R','s','d','a','e','i','A'};
int v,uc,lc;
v=vcount(x[]);
uc=uccount(x[]);
lc=lccount(x[]);
printf("%d vowels\n%d uppercase\n%dlowercase",v,uc,lc);
}
Result => segmentation fault