请问,pta平台scanf在平台给的样例里怎么解决ignoring return value of ‘scanf’, declared with attribute warn_unused_result 的问题。
a.c:43:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &N);
^~~~~~~~~~~~~~~
一般可以用if(scanf(“%d”,&x)){}解决。但是scanf我没办法更改,这怎么解决。
还是不建议用if(scanf("%d",&x)方式吧,检查x值更靠谱一些
%d的双引号不对吧
看一下链接中的解决方式。