How to use functions.
Functions:
1. Declare functions:
Declare all functions before "main".
Declare them like this:
return-type name(argument-list);
example:
int add(int a, int b, int c); // in the argument list need to declare variable types for each input. Sometimes we give meaningful names to each input as well.
Sometimes a function has no input, so we put "void" instead of argument list:
int name(void);
Sometimes a function can have no output, so put "void" before the function name:
void name(char c, char d);
2. Write inside the function:
float mul_two_floats(float a, float b)
{
float product = a * b;
return product;
}
3. Declare all the functions before "main", but put the codes of all functions after "main".