Function abs () in C
The function int abs (int x) returns the absolute value of integer x.
Function abs () in C
The function int abs (int x) returns the absolute value of integer x .
Declare the function abs () in C
Here is the declaration section for abs () in C:
int abs ( int x )
Parameters
x : this is an integer value.
Returns the value
Returns the absolute value of x.
For example
The following C program illustrates the usage of abs () in C:
#include #include int main () { int a , b ; a = abs ( 6 ); printf ( "Gia tri cua a = %dn" , a ); b = abs (- 11 ); printf ( "Gia tri cua b = %dn" , b ); return ( 0 ); }
Compiling and running the above C program will produce the following results:
According to Tutorialspoint
Previous lesson: qsort () function in C
Next lesson: Div () function in C
4.5 ★ | 2 Vote
You should read it
- Call the function by pointer in C ++
- Function realloc () in C
- Malloc () function in C
- The function getenv () in C
- The function rand () in C
- The abort () function in C
- Pass cursor to function in C ++
- Div () function in C
- Cursor this in C ++
- Labs () function in C
- The function ldiv () in C
- The qsort () function in C
Maybe you are interested
Google Labs Releases Whisk: A Tool That Allows You to Upload Images as Instructions Instead of Text Prompts
How to automatically close old Safari tabs - Choose when to close all tabs
How to Enable and Disable Tabs in File Explorer on Windows 11
How to use abstract images to create phone wallpapers
How to take interesting abstract photos on smartphones
Detection of 'super dark' material, capable of absorbing 99.3% of light