getchar() wont read from an array of chars, it reads from the standard input device, one character at a time.
You're right, -1 and \n are each 2 characters, so you can't do a single character comparison to find them. The easiest way is the two-step method you described, though I wouldn't "advance" through the input when getting a - or \. Instead, I would keep the previous char in a separate variable. Something like this:
Code:
int prev_char, curr_char;
...
prev_char = -1; // sentinel value, can't be mistaked of '-' or '\'
while ((curr_char = getchar()) != EOF) {
// check prev_char for - or \ and curr_char for 1 or n
...
prev_char = curr_char; // update prev_char for next iteration
}
That is only one place you have to deal with end of input or errors. The alternative is calling getchar() again inside the loop, if you get a '-' or '\\', and having to check for and handle end of input/error there too.