I have 3 files as below
int x(int a, int b)
return a + b;
In the file b.c, as function add is defined in a.c, I have used extern declaration for the prototype of the function.
extern int x(int,int);
res = add(2,3);
But instead of this, if I use a header file lets say a.h which contains the prototype of the function x as below
then if I include this a.h in b.c, then do I need not place the extern declaration again??
extern declaration tells the compiler that the function x is defined externally in another file.
But if I include the a.h simply in b.c, as it copies the contents of the a.h in b.c, then there will be no extern. So how the compiler knows that function x is defined externally somewhere??