#include <iostream>
#include <conio.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
void swap(char **src, char **dst)
{
char **temp = (char**)malloc(30);
*temp = *dst;
*dst = *src;
*src = *temp;
}
int permute(char** set, int begin, int end)
{
int i;
int range = end - begin;
if (range == 1) {
printf("set: %s %s %s\n", set[0],set[1],set[2]);
} else {
for(i=0; i<range; i++) {
swap(&set[begin], &set[begin+i]);
permute(set, begin+1, end);
swap(&set[begin], &set[begin+i]); /* set back */
}
}
return 0;
}
int main()
{
char *str[] = {"The","Ratheesh","Good"};
permute(str, 0, 3);
return 0;
}