C2084 error when calling function in same file in a diffrent function : <p>So, I'm trying to make a combinatorics library in a .h file. I have a function that calculates the factorial of a number n, followed by a function (in the same file) that uses the factorial function to calculate the combination of n choose k for a given n and k. But when I try to compile the code it throws this error at me: C2048 function 'long factorial(int)' already has a body. (I'm using VS 2015)</p>

<p>Here's the code:</p>

<pre><code>long int factorial(int n) // factorial of n
{
    int summation = n;
    for (int i = 1; i &lt; n; i++)
    {
        summation *= i;
    }

    return summation;
}

double combination(int n, int k) // n choose k
{
    return (factorial(n) / (factorial(k) * factorial(n - k)));
}

double permutation(int n, int k) // n permutation k
{
    if (k != n)
        return (factorial(n) / factorial(n - k));
    else
        return factorial(n);
}

double repetitiveCombination(int n, int k) // repetitive combination of n choose k
{
    return combination(n - 1 + k, k);
}

double orderEquals(int n, int p) // order n objects of wich p are equal
{
    return (factorial(n) / factorial(p));
}
</code></pre>
