Hi all,
I have worked with extern variable(s) a little. But, how does the extern function(s) work. Here is a sample code which i recently saw. Can anyone tell me why the compiler is not complaining about the usage and how does this code work
Test1.c file source code
Code:
//test1.c
#include <stdio.h>
void dummy(int i,int j)
{
printf("I am inside the dummy function with value %d and %d\n",i,j);
}
Test2.c file source code
Code:
//test2.c
int main()
{
extern void dummy(int i); //Here the arguments are mismatched
dummy(2);
return 0;
}
Compiled it using the following gcc command
gcc -Wall -o extern test1.c test2.c
and received not even a warning and when i tried to run this code
./extern
I am inside the dummy function with value 2 and -1075886112
How is this working. Any clues.