Originally Posted by TyrioN
The following does not solve your problem - see Hammer's post below - I added a couple of comments on your use of getchar() for information purposes..
You did ok to assign the value from getchar() to an int, but you should note that you need some extra brackets
What the above code does is to test the return value of getchar() against '\n' and then sets the variable a to 1 or 0. Not exactly what you want.
/* != is of higher precendence than = , so what you really have
is this: */
a = (getchar() != '\n')
Try some extra brackets:
int a = 0;
(a = getchar()) != '\n'