# Numerical Combinations in C

I can't come up with a generic code for a problem like this example

I have 1, 2, and 3 in a vector or 12345.... depending on the input.

There are 6 possible combinations without repeating the same numbers again

123 132 213 231 321 312

Can anyone help?

This is one of the functions I use. I have another for the actual combination

void troca(int *a, int *b) { int x; x=*a; *a=*b; *b=x; }

## Answers

Are you using c++? (You mentioned vector)

Try next_permutation