void partitionEven(int value) { int arr[MAXLENGTH] = {0}; //Make array values all 0 printf("partitionEven %d\n", value); partEven(value, arr, 0); //Initial starting index is 0 }
void partitionEven(int value) { int ind = 0; printf("partitionEven %d\n", value); void partEven( int value, int * arr, int ind); int * arr = malloc(value * sizeof(int)); partEven(value, arr, ind); free(arr); }
void partEven(int *result, int remainder, int loc) { int i; int rem; for(i = 2; i <= remainder; i+=2) { result[loc] = i; rem = remainder - i; rem != 0? partEven(result, rem, loc + 1) : printResult(result, loc + 1); } }
void partEven(int value, int * arr, int ind) { int i; if(value == 0) { printArray(arr, ind); return; } //Start at 2, the lowest even number, and increment by 2 to stay on even numbers for(i = 2; i <= value; i += 2) { arr[ind] = i; partEven(value - i, arr, ind + 1); } }
void partEven(int value, int* arr, int ind) { int n = 0; if (value == 0) { printpart(arr, ind); return; } for (n = 1; n <= value; n++) { if ((n % 2) == 0) { arr[ind] = n; partEven(value - n, arr, ind + 1); } } }
void partitionEven(int value) { int *result = malloc(sizeof(int) * value); partEven(result, value, 0); free(result); }