I'm stuck at a pretty awkward thing. Here's the code:
#include <stdio.h>
#include <stdlib.h>
void processCommand(){
char *c = malloc(sizeof(char) * 128);
scanf("%s", c);
switch(*c){
case '!':
printf("Action");
break;
case '?':
printf("Question");
break;
default:
printf("Unknown Action");
break;
}
}
So what I want is, if the first char of my input is something different than !
or ?
, it should just say it's an unknown action. So it works for typing other characters, but everytime i type a whitespace / tab / nothing, it doesn't do anything ?