char c;
char *str;
int swtch = 0;
c = getchar();
int depth = 0;
while (c != EOF) {

getchar returns an int, not a char, this is especially important as you are comparing against EOF.