I'm trying to use switch case with char[2] in C, but it only supports integers.
int main() {
char c[2] = "h";
switch (c) {
case "h":
printf("done!");
}
return 1;
}
For better understanding, what I'm trying to do is:
if "h" in ")($+#&@+)#"
Basically I want to make a condition that matches a character with a group of characters, but efficiently, the first thing that came to mind is to use switch case but it only supports int. But when I use (int)c
which is recommended in other stackoverflow answers, it doesn't return the ascii value.