C++ factorial function with data type issues
<p>I made a function that calculates factorial numbers from 0 to 16 ( none negative and reasonably small)</p>

<p>but it wont go past n15
any idea what data type i should be using and where?</p>

<pre><code>long factorial(long num1)
{
    long f;

    if (num1 &gt;= 0 &amp;&amp; num1 &lt;= 16)  
    {
        for (long i = 0; i &lt;=num1; i++)
        {
            if (i==0) f = 1;
            else f=f * i;
        }
        return f;
    }
    return 0xFFFFFFFF;
}
</code></pre>
