I'm trying to get a function that stores integers in char. I need to use char rather than int because I need to use the question mark (?) to terminate my loop. However, I can't seem to make my code work. Here's my work:
int main() {
    signed char num;
    scanf("%c", &num);
    if (num!='?') {
        printf("%c\n", num);
    }
    return 0;
}
When I input a negative number (say, -9), I get the output:
-
I tried using the integer print symbol (%d) rather than %c when I was printing the values, as I saw on this question: https://www.quora.com/Can-I-assign-a-negative-number-to-a-char-variable-Why-or-why-not but makes everything I input junky. ie when I input 2, it returns 50.
I was told that signed char should do the thing here, but I'm not sure that's the case now.
Thanks.
 
     
     
     
    