Browse Source

Expanded arithmetic addition by multiple datatypes

remotes/origin/develop
Eric Bagus 11 months ago
parent
commit
66234bc7d9
  1. 12
      src/arithmeticAddition.c
  2. 4
      src/arithmeticAddition.h

12
src/arithmeticAddition.c

@ -17,3 +17,15 @@ double* addition_double(double number1, double number2) {
*result = number1+number2; *result = number1+number2;
return result; 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;
}

4
src/arithmeticAddition.h

@ -5,4 +5,8 @@ int* addition_integer(int, int);
double* addition_double(double, double); double* addition_double(double, double);
float* addition_float(float, float);
long* addition_long(long, long);
#endif //THEADMIRALS_ARITHMETICADDITION_H #endif //THEADMIRALS_ARITHMETICADDITION_H
Loading…
Cancel
Save