I keep forgetting the options
http://www.cyberciti.biz/faq/how-do-i-compress-a-whole-linux-or-unix-directory/
http://www.cyberciti.biz/faq/how-do-i-compress-a-whole-linux-or-unix-directory/
#include <stdio.h>
#include <string.h>
void perm(char * base, int * res, int pos)
{
int i,j;
for (i = 0; i < strlen(base); i++){
for (j = 0; j < pos; j++)
if (i == res[j])
break;
if (j==pos){
res[pos] = i;
if (pos+1 != strlen(base))
perm(base, res, pos + 1);
else{
for (j = 0; j < strlen(base); j++)
printf("%c",base[res[j]]);
printf("\n");
return;
}
}
}
}
int main(){
int i;
char str[10];
int res[10];
printf("Enter a string: ");
scanf("%s",str);
for (i = 0; i < strlen(str); i++)
{
res[0] = i;
perm(str, res, 1);
}
return 0;
}