I have the following code in my program:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int print_numbers_above(double x, float y, int z)
{
printf("x=%lf, y=%f, z=%d\n", x, y, z);
}
int main()
{
double x = 1.25;
float y = 1.25;
int z = 3;
print_numbers_below(x, y, z);
print_numbers_above(x, y, z);
return 0;
}
int print_numbers_below(double x, float y, int z)
{
printf("x=%lf, y=%f, z=%d\n", x, y, z);
}
Output:
x=1.25, y=0.000000, z=Garbage
x=1.250000, y=1.250000, z=3
Now, I know that the function print_numbers_below() should have been declared earlier (or should have been defined before main). But it doesn't throw an error. It assumes it to be an extern function (and since it is returning int, there isn't any conflict of return types). Now, I fail to understand why can't I pass more than 1 argument correctly?
(I'm using Visual Studio 2013)