Guys,
I have a question or two about the following code segment that I hope someone will answer. This was part of a source code file provided on the CD, so I did not pick the variables.
Code:
void output(float a)
{
printf("The average is %.2f\n", a);
}
int main()
{
int num1, num2, num3;
float ave;
num1 = input(1);
num2 = input(2);
num3 = input(3);
ave = average3(num1, num2, num3);
output(ave);
}
My questions:
1) When passing ave to output as 'a' why don't we have to declare 'float a;' in the function--or are we in essence doing that when we declare the function?
2) I have seen a couple different examples of parameters that should be included in the main(). In a case like this, what would be the recommended parameter(s) to include for main to receive? ...void?
The texts I have don't seem to agree and I have no one else to ask; so I very much appreciate the help.
TB