1

I would like to create a function in c that takes in an argument that takes in as an argument an array where for each element it gives the range (from 0 to the number stored at the array index), I would like to return all possibilities

an example would be

int elements[2] = [2,4]
int *combinations = combinations(&elements, 2) // 2 being the size of elements

this would give something along the lines of:

0 0
1 0
0 1
0 2
0 3
1 1
1 2
1 3

I've been stuck as to how I should code it, in order to return an array of arrays so that I can test all combinations possible

a_confused_student
  • 349
  • 1
  • 3
  • 13

0 Answers0