I have the following two files:
file1.c
int main(){
foo();
return 0;
}
file2.c
void foo(){
}
Can I compile and link the two files together so the file1.c will recognize the foo function without adding extern?
Updated the prototype.
gcc file1.c file2.c throws: warning: implicit declaration of function foo.
gcc file1.c file2.c, also I don't know C's exact rules for function calls when it's not seen a prototype but you might have to addint foo();abovemain-Wallwhen giving gcc examples - it helps to get noobs into good habits.