I\'m having some problems runnning the following code. I got this: error C2668: \'pow\' : ambiguous call to overloaded function. I\'ve tried to manually cast the arguments t
Though you marked your question as a C question you actually compile your program as a C++ program because it is C++ that allows to overload functions.
In your case the C++ compiler is unable to select an appropriate overloaded function pow. The error message clear shows what functions the compiler considers. To remove the ambiguity you could call the function for example the following way
result += (n[i] - 'a' + 10)* pow( 16.0, strlen(n) - i - 1.0 );
In this case the compiler would use function
double pow(double,double)
Take into account that in C/C++ function main shall have return type int
.
In C the function is defined as
int main( void ) {
while in C++ it is usually defined as
int main() {
And I think there is a typo
if (n[i] >= 'A')
result += (n[i] - "A" + 10)* pow(16, strlen(n) - i - 1);
Instead of the string literal "A" there shall be character literal 'A'