This may be a stupid question, so stupid answers are expected... ;)
Coming from Pascal, where the order of the code mattered, as in you
could not call a function that was physically below where you were in
the code, as the compiler didn't know it existed yet.
Is this also a concern with C?
This has changed over time as C has evolved as a language.
In the original versions of C, as defined by Dennis Ritchie's PDP-11
compiler, the default return type was always `int`. So if one referred
to a function that the compiler hadn't seen before in the translation
unit (roughly file), then the compiler defaulted to assuming that function returned an `int`. Functions that returned other types, or that didn't
return any type at all (`void`), had to be forward-declared. There's a
syntax for doing this in archaic C that one encounters occasionally.
for example, `extern float foo();`
As C evolved into the language that ANSI standardized in 1988, this
default was preserved but compilers would emit warnings for previously undeclared functions. Now, with C11 and the better compilers,
it is an error to call a function that has been neither previously
defined nor declared. Best practice is to add prototypes for all
externally visible functions to a header file. For static-qualified
functions, which are not visible outside of the translation unit, best
practice is to either declare those with prototypes at the beginning of
the file or declare them before first use.
--- Mystic BBS v1.12 A43 2019/03/03 (Windows/32)
* Origin: Black Flag <ACiD Telnet HQ> blackflagbbs.com (21:1/112)