mwjester@wsuiar.uucp (loki) (11/16/90)
In article <1990Nov14.143802.23021@noose.ecn.purdue.edu>, longshot@monkey.ecn.purdue.edu (The Knight Guard) writes: >> "extern" means that the variable is global, and was declared in a >>separate .c file. If your program occupies only 1 file, you will never >>use this. >> >>John Gordon > > Not true here... Our cc seems to require that all functions/procedures > be defined before the main block. The way around this is to extern all > functions before main... Dunno if this is just our compiler, anyone else > seen this? Any ideas of why? I'm not sure what compiler/environment you're using, but you will often find that a function used in main() is assumed to return type int unless the compiler has reason to believe otherwise. When the function appears later in the text and returns a different type, the compiler accuses you of redefining it. You should be able to work around this by defining the return type expected within main(), e.g. main() { int a,b; double bogus(); . . . } The above just lets the compiler know about bogus()'s return type, and you needn't specify the parameters to the function, just its type. Hope this helps. Max J.
pds@lemming.webo.dg.com (Paul D. Smith) (11/19/90)
[] I'm not sure what compiler/environment you're using, but you will [] often find that a function used in main() is assumed to return type [] int unless the compiler has reason to believe otherwise. In fact, *every* C compiler ever written according to any C dialect from K&R I on will think any function used anywhere returns type `int' _unless_ the compiler has reason to believe (you tell it) otherwise. (If it doesn't it's seriously broken ...) -- paul ----- ------------------------------------------------------------------ | Paul D. Smith | pds@lemming.webo.dg.com | | Data General Corp. | | | Network Services Development | "Pretty Damn S..." | | Open Network Applications Department | | ------------------------------------------------------------------