## What is fabs in c programming?

fabs function is used to find absolute value of a given number where given number is floating point value.

This function is defined in math.h header file.

### Prototype

`double fabs(double x);`

### Parameter

fabs function takes floating point value as input parameter.

### Return value

This function returns absolute value of a given number.

## Example program for fabs in c

```
#include<stdio.h>
#include<stdlib.h>
int main()
{
double x;
x=fabs(-100);
printf("The absolute value of given integer is %lf \n",x);
return 0;
}
```

While using gcc use below command to add math header.

`gcc file_name.c -lm`

### Code explanation

The floating-point absolute value of a given number is found by passing it to the fabs function. The result is being printed onto the console.

## Difference between fabs and abs in c

fabs is used to find out the absolute value of the double type of data. abs in c is used to find out the absolute value of a given number.

Prototypes are as follows

```
double fabs(double y);
int abs(int m);
```

fabs( ) | abs( ) |

Used to find out absolute value of double type of data. | Used to find out absolute value of integer type of data. |

`double fabs(double y);` | `int abs(int m);` |

## People also ask for

### What is fabs in c?

fabs is used to find out the absolute value of the double type of data. It is defined in math.h header file.