Calling a function with same name but different return type!!!
I have a query. I have the following code :
In the above code, I have declared function func() as returning integer and made a call to it in function main() expecting a return from it. This function func() is declared separately in the another file :
extern int func();
int ret = func();
printf("\n Executed!!! with ret[%d] \n", ret);
Here I have defined the functon func() but please note that the signature of this function here says that it returns nothing (void).
printf("\n Inside func()\n");
When I compile the above two files with gcc on linux system, I see no compilation or Linking errors and the executable works fine with func() being called.
Just wanted to ask how is this possible as the declaration and definition of func() has different signatures?