Here is a simple example:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i = -42;
int j = abs(i);
printf("i = %d, j = %d\n", i, j);
return 0;
}
LIVE DEMO
Answer from Paul R on Stack OverflowC Programming Math Functions #include <stdlib.h> abs() - Stack Overflow
Parameter Space of Quasi-characters of Idèle Class Group
How to define a function in C
Is there in AVG function in C? And also, is a importing a module and including a library the same?
How do I include and use math functions in a C program?
What are the limitations of using math functions in C?
How do I handle errors when using C math functions?
Videos
Here is a simple example:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i = -42;
int j = abs(i);
printf("i = %d, j = %d\n", i, j);
return 0;
}
LIVE DEMO
Besides the examples given above,functions work just like a mathematical function in that y = f(x) you put in x and it returns a y(of course some dont return anything and some dont take in anything)
now what you need to do is to catch that value when it returns it by storing it into some memory location which is called a variable that you declare
its also important that you know what the return type is so that you dont truncate or lose some part of the result
for example if the result is a floating point number then you need to return the value into a float/double variable and if it is a integer you can store it in either int or double/float
also if it is a char you would probably want it to be returned to a char variable and so on and so forth
So any function that you write or that you use from somebody elses library/header is going to work like that
It takes in an argument(sometimes it can even take no arguments and you just use it by calling it with parentheses, parentheses must always be typed because otherwise it will look like a variable or something else and convention says so) and it returns some result(if it does return a result) or does something else unrelated to the calling functions variables/values
So hopefully that explains what functions are, and how you can use them
Now all of this described also applies to the functions you posted about, they have a set algorithm that they do which somebody else wrote, and you just give it the argument, and catch the return type and it will do what it says it intended to do i.e abs() gives you the absolute value, pow() returns the square of some base and so on