You need to fix a couple of things:
#include <stdio.h>
double abs(double number); // <<< 1. prototype here
int main()
{
double value1 = -5;
printf("%lf",
abs(value1));
}
double abs(double number)
{
if (number < 0) {
number = number * -1.0; // <<< 2. fix here
}
return number;
}
the
abs
function needs a prototype so that the compiler knows its function signature before you call ityour expression for negating
number
was back-to-front