C语言
函数名: abs
功 能: 求整数的绝对值
头文件:stdlib.h
函数原型:int abs(int i);
程序例:
#include <stdio.h>
#include <stdlib.h>
int main(void)
int number = -1234;
printf("number: %d absolute value: %d\n",number,abs(number));
return 0;
在 C 语言中还有fabs,也是求绝对值的,不同的是,fabs 函数参数与返回值为实型。,fabs 函数参数与返回值为实型。