#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
void perm(int list[], int k, int m)
{
if (k == m)
{
for (int i = 0; i <= m; i++)
{
printf("%d", list[i]);
}
cout << endl;
}
else
{
for (int i = k; i <= m; i++)
{
swap(list[k], list[i]);
perm(list, k+1, m);
swap(list[k], list[i]);
}
}
}
int main()
{
int list[] = {1, 2, 3, 4, 5};
int len = sizeof(list) / sizeof(list[0]);
perm(list, 0, len-1);
printf("len: %d\n", len);
return 0;
}