This is an iterative implementation of Heap's Algorithm
See the wikipedia page for more info
I use global variables so that the output can be passed to a return statment.
change the "#define JEB" value and compile to modify list length (Be wary of factorials that exceed max int)