I want to call functions defined in test.c from other.c.
Can I extern
the function1
to call it? Also, do I have to use extern
in <
Actually every function by default is extern :) - unless you declare them to be not :). It is enough if you have the prototype before the first call;
int xxx(int, int, float, double); // prototype
int main(void)
{
int x,y;
float z;
double v;
xxx(x,y,z,v);
return 0;
}
Function can be in the another .c file. You need to include the object file to the linking.
int xxx(int a, int b, float c, double d)
{
int result;
/* do something */
return result;
}