(Posting this answer as there are many misconceptions in the main comments):
- In all versions of Standard C,
A
can call B
, and B
can call A
- A prototype is not required in any version of Standard C. (But it is a good idea to use one anyway as they help the compiler to diagnose errors).
- In ISO C99 and ISO C11, a function declaration must be visible of the function being called.
- In ISO C90, it is possible to call a function without a visible declaration. This call runs correctly if all of the following conditions are met (otherwise the behaviour is undefined):
- The function definition returns
int
(or omits the return type)
- The function definition is not variadic
- The ordered list of types of the arguments, after the default argument promotions are applied, matches exactly the ordered list of types of the parameters to the function definition (the parameter types are not promoted).
For example, in all versions of Standard C, the ...
in the OP code inside B()
may be replaced with:
void A();
A(w, i);
making a correct program. In ISO C90, the ...
may be replaced with simply:
A(w, i);
The standards makes this legal in order to avoid breaking existing code which was written before prototypes were invented. It would be embarrassing if the code in K&R1 stopped working in Standard C.
I repeat that it is not a good idea to do this on purpose if you are writing new code; it's better to put a prototype, and the best position for the prototype is outside of the function.
You can download drafts of the ISO C11 standard, and the ISO C99+TC3 standard here. AFAIK there is no free and legal copy of the C90 or original C99 text. The cheapest legal way to get the C90 text is to buy the book The Annotated C Standard. This is cheaper than buying it from ISO, although it is said that the price difference represents the added value of the annotations.
There are many second-hand sources of information about Standard C, e.g. questions on this site which are tagged c.