Hey guys, I'm a pretty novice programmer, so this might seem like some fantastically-simple question.
Suppose I have something like:
What is the purpose of declaring the function void foo(void) twice (that is, once at the top of the program, and then again in main())?Code:#include <stdio.h> void foo(void); int main(void) { int x; void foo(void); blah blah blah code; return 0; } void foo(void) { barcode; }
The answers I'm getting from searches are less than satisfactory. I'm getting the feeling that if I declared the function only within main() that the function is only callable within main(), too? Whereas functions declared at the top of the program are callable anywhere? But even so, that still doesn't answer the question of why declare it twice?
Confirm, deny, extrapolate?
Thank you.