Hi Everybody,

I require your help for finding a solution of a mathematical problem in C language. The brief details of the problem is as follows:

I have a global array of ‘n’ elements of type integer having some values. I want to write a function, which takes two int as a parameter one will be the size of the array i.e. ‘n’ and second parameter will be used to generate the combination (m) say if second parameter is ‘3’ the function has to fetch 3 elements of the array store it in some temp array or pointer and pass it on to some function after that again fetch 3 elements so on till the maximum limit is not reached which can be find out by nCm.
To be more clear consider the following example:
The Array is of 7 elements having elements data starting from 1 to 7. If m is 3 then no of temporary combinations will be nCm=35, which are as follows:
123 134 145 156 167
124 135 146 157
125 136 147
126 137
127

234 245 256 267
235 246 257
236 247
237

345 356 367
346 357
347

456 467
457

567

The same sequence is applied for any value of m be it 2,3,4,5 etc. It will be kind if anybody help me or send me the algorithm or program to perform this task.

Please note that the size of m is not known at design time it will be passed at a runtime.

Thanking You,

-Tejash.