From 66234bc7d9352881032fa5b269f743ae8f8495a3 Mon Sep 17 00:00:00 2001 From: Eric Bagus Date: Thu, 8 Feb 2024 19:28:42 +0100 Subject: [PATCH] Expanded arithmetic addition by multiple datatypes --- src/arithmeticAddition.c | 12 ++++++++++++ src/arithmeticAddition.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/arithmeticAddition.c b/src/arithmeticAddition.c index 7d664f2..8f93738 100644 --- a/src/arithmeticAddition.c +++ b/src/arithmeticAddition.c @@ -16,4 +16,16 @@ double* addition_double(double number1, double number2) { double* result = malloc(sizeof(double)); *result = number1+number2; return result; +} + +float* addition_float(float number1, float number2) { + float* result = malloc(sizeof(float)); + *result = number1+number2; + return result; +} + +long* addition_long(long number1, long number2) { + long* result = malloc(sizeof(long)); + *result = number1+number2; + return result; } \ No newline at end of file diff --git a/src/arithmeticAddition.h b/src/arithmeticAddition.h index ab7db2a..3bad5ba 100644 --- a/src/arithmeticAddition.h +++ b/src/arithmeticAddition.h @@ -5,4 +5,8 @@ int* addition_integer(int, int); double* addition_double(double, double); +float* addition_float(float, float); + +long* addition_long(long, long); + #endif //THEADMIRALS_ARITHMETICADDITION_H