Switch statement help please !

I am trying to make a bracket operator and I can not get this switch statement to work properly.

character is type char.


Stack<char> unmatched;

for (int i = 0; i < str.length(); i++) {
char character;
character = str[i];


switch (character) {
case "{":
unmatched.push(character);
break;
case "[":
unmatched.push(character);
break;
case "(":
unmatched.push(character);
break;
}
use single quote for char type.
Topic archived. No new replies allowed.