Program does not go into the switch statements at all !

A character is either going to be equal to comma or not. The first and second if statements take care of all possibilities (== and !=) if you just compare to comma, so the last else part never gets executed.

Are you sure you need the last else statement? Should this just be outside the if/else?