User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdlib.h:abs

abs

    #include <stdlib.h>
    int abs(int i);

computes the absolute value of the integer i

C Sourcecode Example

#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 /* for printf */
#include <stdlib.h>
 
int main( void )
{
  int i = -42;
  printf("abs from i = %d\n", abs(i));
  return 0;
}

output with abort:

  user@host:~/code-reference.com# ./abs 
  abs from i = 42

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/stdlib.h/abs.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz