:
Change it so that main is last. You get all the same benefits for
the graders, and teach better habits.
Agree the same benefit -- and I don't understand anyway why it's
important to "find main" but not similarly find anything else. Better
habits is arguable -- there are benefits to both topdown and bottomup.
Ideally I would say teach (and practice) *both*, but the OP sounds
like he already has quite enough material he needs to cover.
Prototypes in headers are > for export.
But he didn't say to put them in a header; I understood him to mean
putting them above and below main() in the source (.c) file.
Personally I don't like the before/after split; if/when I want to do
topdown, I put *all* forward declarations before main(), or the other
top-level/entry routine(s) for a non-main module.
C requires declare before use, and duplicate
prototypes are an error source. It also discourages marking
non-exported routines as static.
Strictly speaking C89 does not require predeclaring functions in
certain limited cases, but ignore that; it's *abysmal* style.
Separate (forward) declarations are a little extra work to write and
maintain, and take up some space, but if you use prototypes for both
file-scope declaration and definition, as you should, any mismatch
will (is required to) be diagnosed.
I don't see how it "discourages" marking static=internal -- if
anything, by collecting the internal declarations in one place, while
the external declarations should be (as you noted earlier) in a header
file, I think it makes it slightly *easier*.
- David.Thompson1 at worldnet.att.net