abs.c

来自「KPIT GNU Tools is a set of GNU developme」· C语言 代码 · 共 44 行

C
44
字号
/*FUNCTION<<abs>>---integer absolute value (magnitude)INDEX	absANSI_SYNOPSIS	#include <stdlib.h>	int abs(int <[i]>);TRAD_SYNOPSIS	#include <stdlib.h>	int abs(<[i]>)	int <[i]>;DESCRIPTION<<abs>> returns@tex$|x|$,@end texthe absolute value of <[i]> (also called the magnitudeof <[i]>).  That is, if <[i]> is negative, the result is the oppositeof <[i]>, but if <[i]> is nonnegative the result is <[i]>.The similar function <<labs>> uses and returns <<long>> rather than <<int>> values.RETURNSThe result is a nonnegative integer.PORTABILITY<<abs>> is ANSI.No supporting OS subroutines are required.*/#include <stdlib.h>int_DEFUN (abs, (i), int i){  return (i < 0) ? -i : i;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?