I’m recently introduced in the programming world and the C language.
I've encountered a trouble understanding the following concept when I tried to
utilize the pow function from the math.h library, in order to do some calculations in my code.
While I passed as parameters to the pow function the two variables, x and i, both declared as integers, I got an Error from my IDE(Visual Studio 2012) stating
: “more than one instance of overloaded function “pow” matches the argument list" :
Function “pow(double _X, int _Y)”
Function “pow(float _X , int _Y)”
Function “pow(float _X , int _Y)”
Function “pow(long double _X, int _Y)”
Argument types are ( int, int ).
I know that the pow function returns a double value but what happens, let’s say when you need to work only with integers ? Why is it not possible to store the return value of the function to a declared variable as a double and having two integers as parameters?
Searching Wikipedia ,when I couldn't find anything relevant here in Stack Overflow, the only given definition for function overloading is the following one:
“Function overloading or method overloading is a feature found in various programming languages such as Ada, C++, C#, D, and Java, that allows creating several methods with the same name which differ from each other in the type of the input and the output of the function. It is simply defined as the ability of one function to perform different tasks. “
What is function overloading exactly and how it affects the behavior of this particular function that I try to implement ?
Sorry in advance if the question is too trivial or answered, or I’m missing an obvious piece of the puzzle .