Back To C User Defined Functions Index
//program to create a function that check whether character passed to it as argument is vowel or not using switch case statement #include
#include
void checkvowel(char); void checkvowel(char ch) { switch(ch) { case 'a': printf("you entered a vowel"); break; case 'e': printf("you entered a vowel"); break; case 'i': printf("you entered a vowel"); break; case 'o': printf("you entered a vowel"); break; case 'u': printf("you entered a vowel"); break; default:printf("please enter a vowel (a,e,i,o,u)"); } } void main() { char ch; clrscr(); printf("enter a character"); scanf("%c",&ch); checkvowel(ch); getch(); }