wak*_*k99 11 c math.h absolute-value
我使用了这个abs()函数,我#include <math.h>在代码顶部添加了.但我一直收到这个错误:
hello.c:20:11: warning: implicit declaration of function 'abs' is invalid in C99
[-Wimplicit-function-declaration]
int a = abs(arrOfHour[i] - hour) * 60 + minute;
^
Run Code Online (Sandbox Code Playgroud)
我正在使用LLVM编译器.
为什么即使我已经包含了这个错误math.h?
tux*_*ux3 24
我将直接从文档中引用:"abs,labs和llabs的原型在stdlib.h中"
根据经验,对浮点数进行操作的数学函数在math.h中,对整数进行操作的数学函数在stdlib.h中.
有一个相当不错的维基百科文章基于C数学函数,如果你需要更多的信息.