I have simple programm in two units:
count_words.c:
int main( int argc, char ** argv )
{
printf("starting\n");
int i = aaa(55555);
printf("%d",i);
printf("ending\n");
return i;
}
clean.c:
int aaa()
{
printf("aaa\n");
return 5;
}
Makefile:
count_words: clean.o count_words.o -lfl
gcc count_words.o clean.o -lfl -ocount_words
%.o:%.c
gcc -c -o $@ $<
I'm wondering why this code compiles and runs without problem. Function aaa() in clean.c has no parameters, but in count_words.c I pass 55555. Why it compiles and runs. Can I expect unexpected errors in such situations?
UPD:
I have changed int aaa() to int aaa(void), but still have warning and not error.
As you noticed I didn't include header of clean.c in count_words.c and it compiles anyway. Why then I must include headers at all?