From The C Programming Language 2nd Edition:
Since an argument of a function call is an expression, type conversions also take place when arguments are passed to function. In absence of a function prototype, char and short become int, and float becomes double.
By reading the text, I am getting an impression that unless you explicitly specify the argument type by either using cast or function prototype, function arguments will always be passed as either passed as int or double.
In order to verify my assumption, I compiled the following code:
#include <stdio.h>
main()
{
unsigned char c = 'Z';
float number = 3.14f;
function_call(c, number);
}
void function_call(char c, float f)
{
}
After compilation I get the following warnings:
typeconversion.c:11: warning: conflicting types for ‘function_call’
typeconversion.c:7: warning: previous implicit declaration of ‘function_call’ was here
My guess is c and number were both converted to int and double on the function call, and were then converted back to char and float. Is this what actually happened?