There are two source files, a.c and b.c. a.c:
int main(void)
{
    foo();
    return 0;
}
b.c:
#include <stdio.h>
static void bar(void)
{
    puts("Hola!");
}
extern void (*foo)(void) = bar;
Compile them together (cl a.c b.c), run the program, the program will crash. Why is that?
However, a declaration like extern void (*foo)(void); would solve the problem.
My environment is Windows MSVC:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
I guess it's because:
- Since foois not declared, the compiler guesses that it's a function.
- However, foois not a function, but a variable, so the calling fails.
