From 5a6c45a9fddf6a5ad7eff86d01687f67dafd3595 Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Thu, 8 Feb 2024 18:57:26 +0100 Subject: [PATCH] added type float to multiplication --- src/arithmeticMultiplication_Float.c | 12 ++++++++++++ src/arithmeticMultiplication_Float.h | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/arithmeticMultiplication_Float.c create mode 100644 src/arithmeticMultiplication_Float.h diff --git a/src/arithmeticMultiplication_Float.c b/src/arithmeticMultiplication_Float.c new file mode 100644 index 0000000..1014f33 --- /dev/null +++ b/src/arithmeticMultiplication_Float.c @@ -0,0 +1,12 @@ +#include "arithmeticMultiplication_Float.h" +#include + +float* multiplication_float(float num1, float num2) { + float* result = (float*)malloc(sizeof(float)); + if (result == NULL) { + return NULL; // Handle memory allocation failure + } + *result = num1 * num2; + return result; +} + diff --git a/src/arithmeticMultiplication_Float.h b/src/arithmeticMultiplication_Float.h new file mode 100644 index 0000000..48ff7a8 --- /dev/null +++ b/src/arithmeticMultiplication_Float.h @@ -0,0 +1,13 @@ + +#ifndef THEADMIRALS_ARITHMETICMULTIPLICATION_FLOAT_H +#define THEADMIRALS_ARITHMETICMULTIPLICATION_FLOAT_H + + + + + + +float* multiplication_float(float num1, float num2); + + +#endif //THEADMIRALS_ARITHMETICMULTIPLICATION_FLOAT_H