Why reading '+' and '-' not work in Linux?

后端 未结 3 1191
一个人的身影
一个人的身影 2021-01-15 10:25

I have this fragment of code that reads arithmetic expressions like 1 + 2 * 3 into integers and characters:

int main() {
    int d, flag = 0;
           


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 10:43

    '+2' was scanned to 'd' because of scanf("%d", &d)). You can try with '1-2' and see that '-' also can't display.

提交回复
热议问题