Using scanf to accept user input

前端 未结 5 655
轻奢々
轻奢々 2020-12-06 13:52

gcc 4.4.2

I was reading an article about scanf. I personally have never checked the return code of a scanf.

#include 

int main(void)
         


        
5条回答
  •  臣服心动
    2020-12-06 14:32

    I make a loop call fgets until the end of the line is read, and then call sscanf to parse the data. It's a good idea to check whether sscanf reaches the end of the input line.

提交回复
热议问题