labs.c

来自「cygwin, 著名的在win32下模拟unix操作系统的东东」· C语言 代码 · 共 50 行

C
50
字号
/*FUNCTION<<labs>>---long integer absolute valueINDEX	labsANSI_SYNOPSIS	#include <stdlib.h>	long labs(long <[i]>);TRAD_SYNOPSIS	#include <stdlib.h>	long labs(<[i]>)	long <[i]>;DESCRIPTION<<labs>> 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 <<abs>> uses and returns <<int>> rather than<<long>> values.RETURNSThe result is a nonnegative long integer.PORTABILITY<<labs>> is ANSI.No supporting OS subroutine calls are required.*/#include <stdlib.h>long_DEFUN (labs, (x),	long x){  if (x < 0)    {      x = -x;    }  return x;}

⌨️ 快捷键说明

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