Pause screen at program completion in C

前端 未结 7 533
名媛妹妹
名媛妹妹 2020-12-17 06:00

I want to be able to do something along the lines of Press any key to exit at program completion, but have no been able to figure out how to.

When I run

7条回答
  •  悲&欢浪女
    2020-12-17 06:28

    getchar() is the right way to go, but you'll run into problems caused by scanf leaving '\n' in the input buffer - it will return immediately. See Why doesn't getchar() wait for me to press enter after scanf()?

提交回复
热议问题