type specifier float
in the first line after main has nothing common with functions because this line defines scalar objects.
Statement
float a, h, w;
defines objects a, h, and w as having type float
that is these objects can store float numbers.
I think your professor means the following
int main()
{
float a, h, w;
h = 3.0;
w = 4.0;
a = rectArea(h, w);
cout << "area = " << a << endl;
return 0;
}
Otherwise variable a
is defined but not used in the program.
The code would be more clear if he used more meaningful names. For example
int main()
{
float area, height, width;
height = 3.0f;
width = 4.0f;
area = rectArea(height, width);
cout << "area = " << area << endl;
return 0;
}
What is the purpose of float a after int main()?
Shortly speaking the purpose of variable a is to store the result of calculating the area of a rectangle. In fact it is redundant if you are going simply to output the area on console. In this case you could remove the definition of a and write in the output statement
cout << "area = " << rectArea(h, w) << endl;
as it is shown in the original code.