Right solution to exercise 5.4

Your solution generates only combinations of size 2.
Combinations can however have bigger or smaller size.
E.g if I have an array {1,2,3,4} then all combinations of size 3 are: 
1,2,3
1,2,4
1,3,4
2,3,4

Therefore if the function in the exercise must print all combinations, it should print combinations from size 1 to size equal to the length of provided array (4 in my example.)
See https://en.wikipedia.org/wiki/Combination for better definiton.