Calling a function from another file in the same directory in C

Viewed 81050

I'm learning C, but i have a long experience with higher level programming languages like Java.

I was reading about header files so i was playing around with them, however I noticed that I could call a function from another file without #including it (it's in the same directory), how is that possible ?! Is it the make file, linker that is configured that way or what ?

We have two files

main.c
add.c

main.c calls the function add(int x,int y) from add add.c, but I mistakenly compiled before #including add.c and it worked ! What makes it more confusing is that when i #include add.c, it gives a multiple-definition error on function add

4 Answers
Related