diff --git a/src/arithmeticAddition.c b/src/arithmeticAddition.c index 173c438..46a2e37 100644 --- a/src/arithmeticAddition.c +++ b/src/arithmeticAddition.c @@ -3,6 +3,7 @@ #include #include +// addition for two integer inputs (no decimal number) int* addition_integer(int num1, int num2) { if ((num2 > 0 && num1 > INT_MAX - num2) || (num2 < 0 && num1 < INT_MIN - num2)) { return NULL; @@ -12,18 +13,21 @@ int* addition_integer(int num1, int num2) { return result; } +// addition for two double inputs (decimal number) double* addition_double(double num1, double num2) { double* result = malloc(sizeof(double)); *result = num1+num2; return result; } +// addition for two float inputs (decimal number) float* addition_float(float num1, float num2) { float* result = malloc(sizeof(float)); *result = num1+num2; return result; } +// addition for two long inputs (no decimal number) long* addition_long(long num1, long num2) { long* result = malloc(sizeof(long)); *result = num1+num2;