Hi all,
Need the community great support once more. :)
I need to know how to calculate the power of some numbers in C, the problem is that the number is too big , and the compiler gives a error when doing the arithmetics.
See the power function I am using:
unsigned long int power(int base, int n)
{
unsigned long long int p;
int i;
p = 1;
for (i = 1; i <= n; ++i)
p = p * base;
return p;
}
Passing the parameter 2 as base, I can't execute this function with a n greater than 32... the problem is that I need to calculate from 2**0 to 2**64.
Hope I made myself clear about what I need
Any suggestions?
Thanks!
Gus