You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
335 B

  1. #include "arithmeticAddition.h"
  2. #include <stdio.h>
  3. #include <limits.h>
  4. #include <stdlib.h>
  5. int* addition_integer(int num1, int num2) {
  6. if ((num2 > 0 && num1 > INT_MAX - num2) || (num2 < 0 && num1 < INT_MIN - num2)) {
  7. return NULL;
  8. }
  9. int* result = malloc(sizeof(int));
  10. *result = num1 + num2;
  11. return result;
  12. }