This is not what I wanted to do, becouse you have to edit it if you need yo work with longer arrays. It could be do with a recursive function, but I am too tired to be able to code it:
#include <stdlib.h>
int main()
{
char *pos[]={"a", "b", "c" };
int c=3;
int i=0;
int a=0;
int b=0;
int max=0;
// c=3; n=3
for(i=0; i<c; i++)
{
// x=0
printf("%s\n", pos[i]); // No bucle
b=i;
// x=1
for(a=i+1; a<c; a++) // x=1 so 1 bucle
{
printf("%s%s\n", pos[i], pos[a]); // This would be done like int alpha=c-(i+1); for(t=0; t<alpha; t++) printf("%s", pos[i+alpha]
}
// x=2
for(a=i+1; a<c; a++) // x=2 so 1 bucle
{
for(b=a+1; b<c; b++) // and 2 bucles
printf("%s%s%s\n", pos[i], pos[a], pos[b]);
}
}
getc(stdin);
}
How this should be done:
Having a n elements array.
We need n "for" bucles, indexed by x from 0 to n.
Each one of these would have from x=0 to x=n-1 bucles inside. If x=0, no bucle, just printf.
Each one of these sub bucles would have a for inside being its limit x having a printf inside. This is to print character by character.
I don't hope you understand me becouse actually I don't understand myself at this hours very well, but I have tried...