Use C abs function to get the absolute value
Syntax
C abs function has the following syntax.
int abs(int num);
Header
C abs function is from header file stdlib.h.
Description
C abs function
returns the absolute value of num
.
Example
C abs function gets the absolute value.
#include <stdlib.h>
#include <stdio.h>
/*w w w.ja v a 2 s.co m*/
int main(void){
printf("%d",abs(-1));
}
The code above generates the following result.