question about C not using prototypes

Hi there,
I know one of the distinguishables btw C & C++ is the fact the C++ requires the use of prototypes whereas C doesnt.

So, if C doesnt require the use of prototypes or otherwise it(prototypes) doesnt exist ,
is function call from function A to function B which then calls function A achievable in C ?
C++ requires the use of prototypes
Says who?

Both C and C++ allow but don't mandate declaration of functions.
The following is valid both in C and C++:
1
2
3
4
5
6
void a(){
}

void b(){
    a();
}
And so is this:
1
2
3
4
5
6
7
8
9
10
void a();
void b();

void a(){
    b();
}

void b(){
    a();
}
Last edited on
I mean long time ago , C programs didnt use prototypes , is that true ?
If so , they obviously cannot have functions call each other ?
I mean long time ago , C programs didnt use prototypes , is that true ?

No.
I see.
Just my book writes that , I shouldnt taken it seriously, :D
The old C, which we call K&R C, does not require prototypes. The declaration syntax for function arguments was different too. K&R being Brian Kernigan (who documented C and is also the K in AWK) and Dennis Ritchie (who developed C from B). Some Unix C compilers, such as Solaris, still support K&R mode for compiling old code.

If a function is used before it was declared, it is assumed to take a variable number of args and return an int.

Prototypes were introduced into C with Classes (early C++) and adopted by C as part of the ANSI standardisation process because it seemed like a good idea.

So, ANSI C uses prototypes, K&C C doesn't.
Topic archived. No new replies allowed.