Define same function name in one C project -


i have main file includes 2 h files both of them has function foo(). happens when call foo main? 1 chosen?

thanks

edit: saw answer, can this: (its working) :

///////////// file: q7lib.h #include <stdio.h> void foo (); /////////////  end of file ///////////// file: q7lib.c #include "q7lib.h" void foo () {     printf ("q7lib: foo"); } /////////////  end of file  ///////////// file: q7.h #include <stdio.h> void foo (); /////////////  end of file ///////////// file: q7.c #include "q7.h" void foo () {     printf ("q7: foo"); } /////////////  end of file  ///////////// file: q7main.c ////////////// #include "q7.h" #include "q7lib.h" int main () { foo (); return 0; } ///////////// end of file ///////////////// 

you won't far calling function because linker won't accept program. linker reject program when encounters multiple definitions of same function.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -