Hier mal der klassische Lösungsansatz zum Problem. Eine Sache war mir noch unklar, der Permutationscode unten (google) vertauscht die Elemente und gibt alle Kombinationen aus. War das von dir erwünscht oder sollen auch Elemente öfter vorkommen können?
Code:
#include <stdio.h>
#include <conio.h>

char in[] = "01234";

void permutation(char *pSet, long pIndex, long pSetSize)
{
	if(pIndex == pSetSize - 1)
	{
		printf("\n\t");
		for(long i = 0; i < pSetSize; i++) printf(" %c", pSet[i]);
	}
	else for(long i = pIndex; i < pSetSize; i++)
	{
		char Old = pSet[i];
		pSet[i] = pSet[pIndex];
		pSet[pIndex] = Old;

		permutation(pSet, pIndex + 1, pSetSize);

		pSet[pIndex] = pSet[i];
		pSet[i] = Old;
	}
}

int main()
{
	permutation(in, 0, 5);
	getch();
}