Here goes newbie question number 5, but I don\'t have a teacher.. so.. anyhow here we go:
I\'m wondering if is necessary to have function prototypes at the top of the fi
This declares but does not define the function say_hi
:
void say_hi();
This both declares and defines the function say_hi
:
void say_hi(){
std::cout << "hi" << std::endl;
}
You can declare a function many times; you can only define it once.
A function must be declared in the file before you can call it. A function must be defined somewhere--in the same file before or after you call it or maybe even in a different file.
So, yes, this is perfectly fine.