Basic Functions

Here you can find simple function examples that aren't really useful but serve as an example for how to create and format simple user defined functions

Simple Addition

#include <stdio.h>

int add(int a, int b) {
 return a + b;
}

Takes two int arguments, adds them together and returns their sum

Simple Subtraction

#include <stdio.h>

int sub(int a, int b) {
 return a - b;
}

Takes two int arguments, subtracts the second from the first and returns their difference

Simple Multiplication

#include <stdio.h>

int mult(int a, int b) {
 return a * b;
}

Takes two int arguments, multiplies them together and returns their product

Simple Division

#include <stdio.h>

float div(float a, float b) {
 return a / b;
}

Takes two float arguments, divides the first by the second and returns their quotient