write a c program to print all possible combinations of given characters. For example if given characters are [a b c d] then ,its all possible combinations are as follows

 

print all possible combinations of given characters

c program to print all possible combinations of given characters

How it works

Let us see our input [ a b c d]. A combination is a selection problem. If we need to find all possible combinations of r element ( Ex. r =2) ,then in this case, to make a combination of two either we select a character from input [a b c d] or we do not select. Our program has the same logic as it is getting called with following

With the help of a temporary array out, in case of character selection we put the selected character in helper array out.




Related Contents to follow