simple function call not working, any ideas?

Getting [Error] expected primary-expression before 'char', why?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <math.h>

using namespace std;


bool IsVowel (char Ch)	{
	switch (Ch){
		case 'a': case 'A':
		case 'e': case 'E':
		case 'i': case 'I':
		case 'o': case 'O':
		case 'u': case 'U':
			return true;
		default:
			return false;
	}
}

int main(){
char letter;
cin >> letter;
cout << IsVowel (char letter);
	return 0;
}
remove "char" on line 23, one doesn't pass the type of variable to function call
I figured it out

Its not necessary to declare functions' arguments' object types when invoking them in main, so take out char

line 23: I changed "cout << IsVowel (char letter)" to "cout << IsVowel(letter)" and it worked perfectly

Hope this helps someone having the same problem
Topic archived. No new replies allowed.