C语言编程错误及分析记录

来源:互联网 发布:java编程思想pdf 编辑:程序博客网 时间:2024/05/22 11:30
  1. warning: the `gets' function is dangerous and should not be used.
    解释链接:http://stackoverflow.com/questions/1694036/why-is-the-gets-function-so-dangerous-that-it-should-not-be-used
  2. error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
    解释链接:http://stackoverflow.com/questions/1694036/why-is-the-gets-function-so-dangerous-that-it-should-not-be-used
  3. warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      while(dentp = readdir(dp) != NULL)
    这个warning是由于if中的条件表达式书写有误,如果不将其消除,会在执行期间引发段错误。将其改成如下形式:
    while((dentp = readdir(dp)) != NULL)
    因为条件运算符优先级高于赋值运算符。

0 0
原创粉丝点击