From f6dffc93d3230cf976e59cf109dc1ddca0fa1c7e Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Thu, 8 Feb 2024 18:55:08 +0100 Subject: [PATCH] added type double to multiplication --- src/arithmeticMultiplication_Double.c | 12 ++++++++++++ src/arithmeticMultiplication_Double.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/arithmeticMultiplication_Double.c create mode 100644 src/arithmeticMultiplication_Double.h diff --git a/src/arithmeticMultiplication_Double.c b/src/arithmeticMultiplication_Double.c new file mode 100644 index 0000000..845eaa1 --- /dev/null +++ b/src/arithmeticMultiplication_Double.c @@ -0,0 +1,12 @@ +#include "stdlib.h" +#include "arithmeticMultiplication_Double.h" + + +double* multiplication_double(double num1, double num2) { + double* result = (double*)malloc(sizeof(double)); + if (result == NULL) { + return NULL; // Handle memory allocation failure + } + *result = num1 * num2; + return result; +} diff --git a/src/arithmeticMultiplication_Double.h b/src/arithmeticMultiplication_Double.h new file mode 100644 index 0000000..0642564 --- /dev/null +++ b/src/arithmeticMultiplication_Double.h @@ -0,0 +1,14 @@ + + +#ifndef THEADMIRALS_ARITHMETICMULTIPLICATION_DOUBLE_H +#define THEADMIRALS_ARITHMETICMULTIPLICATION_DOUBLE_H + + + + + +double* multiplication_double(double num1, double num2); + + + +#endif //THEADMIRALS_ARITHMETICMULTIPLICATION_DOUBLE_H