Scanf causes C program to crash

前端 未结 2 1195
半阙折子戏
半阙折子戏 2020-11-30 15:03

This simple issue is causing my entire program to crash during the first input. If I remove the input, the program works fine but once I add scanf into the code and enter th

2条回答
  •  [愿得一人]
    2020-11-30 16:00

    Use "&answer". And get rid of the extraneous "fflush()" commands...

    Better, substitute "answer = getchar ()".

提交回复
热议问题