Your code has following errors:
wrong declaration of array inside main
Code:
char alpha[p];
char conv[f];
and..
The if condition
Code:
if(alpha[p]='A'||'E'||'I'||'O'||'U')
I did some modification in your code and I think its working now.. check this out
Code:
#include <stdio.h>
char tolower(char p);
char toupper(char p);
int main()
{
int p=0,a=0,i=0,o=0,u=0,e=0, f;
char alpha[20];
printf("\n Enter characters : \t");
scanf("%s",&alpha);
while( alpha[p]!=EOF)
{
if(alpha[p]=='A'||alpha[p]=='E'||alpha[p]=='I'||alpha[p]=='O'||alpha[p]=='U')
{
alpha[p]=tolower(alpha[p]);
}
switch (alpha[p])
{
case 'a' :
{
a++;
break;
}
case 'e' :
{
e++;
break;
}
case 'i' :
{
i++;
break;
}
case 'o' :
{
o++;
break;
}
case 'u' :
{
u++;
break;
}
} //End of Switch
p++;
} //End of While
printf("\n a=\t %d",a);
printf("\n e=\t %d",e);
printf("\n i=\t %d",i);
printf("\n o=\t %d",o);
printf("\n u=\t %d",u);
return 0;
} //End of Main
char toupper(char p)
{
int x;
x = (int)p - 32;
return x;
}
char tolower(char p)
{
int x;
x = (int)p + 32;
return x;
}