 <p>what i understand is </p> <p>you want to calculate the combination for any value of n and k in nCk,</p> <p>define a factorial() function outside and define a combi() function ... which calculates Combination value of n and k variables</p> <p>both function before defining the main() function... that way you can avoid declaration and then defining (i mean avoid extra lines of code).</p> <p>here is the code for combi() function</p> <pre><code>function combi(int n , int k){ int nFact, kFact, n_kFact, p; int comb; nFact=factorial(n); kFact=factorial(k); p=n-k; n_kFact=factorial(p); comb= nFact / ((n_kFact) * kFact); return comb; } </code></pre> <p>you can call this function in your main function .... use for loop to store the combination value for relative n and k .... thus you will get what you need .... also pass pointer or </p> <pre><code>&amp;array[0][0] </code></pre> <p>i.e. starting address for the array... so that you can access that array anywhere in the program.</p> <p>hope this may help you. thanks</p>