scanf的返回值

参考这个博客,https://blog.csdn.net/sinat_40936062/article/details/84348021

 1 #include<stdio.h>
 2 
 3 int main(void)
 4 {
 5     int t;
 6     if (scanf_s("%d", &t) == 1)
 7     {
 8         printf("%d\n", t);
 9     }
10     else
11     {
12         printf("Failed to read integer.\n");
13     }
14 
15     return 0;
16 }

 

posted @ 2019-11-01 10:07  jason2018  阅读(236)  评论(0编辑  收藏  举报