Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>abs() calculate absolute value of integer</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 abs()                   Calculate Absolute Value of Integer

 #include   <stdlib.h>                   For function declarations

 int        abs(n);
 int        n;                           Integer value

    abs() returns the absolute value of the integer 'n'.

    Returns:    The absolute value of 'n'; no error return.

   -------------------------------- Example ---------------------------------

    The following statements calculate the absolute values of -15, 0 and
    33.

           #include <stdlib.h>     /* Required for function declaration only
           */

           main()
           {
               int x, y, z;

               x = abs(-15);  /* x = 15 */
               y = abs(0);    /* y =  0 */
               z = abs(33);   /* z = 33 */
           }


See Also: cabs() fabs() labs()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson