'function definition without prototype
when function definition is below, and there is no function prototype.
int main(void)
{
func();
void (*pFunc)(void) = func;
}
void func(void)
{
}
main.c:3:2: warning: implicit declaration of function 'func' is invalid in C99 [-Wimplicit-function-declaration]
func();
^
main.c:4:9: error: incompatible function pointer types initializing 'void (*)(void)' with an expression of type 'int ()' [-Werror,-Wincompatible-function-pointer-types]
void (*pFunc)(void) = func;
^ ~~~~
main.c:4:9: warning: unused variable 'pFunc' [-Wunused-variable]
main.c:7:6: error: conflicting types for 'func'
void func(void)
^
main.c:3:2: note: previous implicit declaration is here
func();
^
2 warnings and 2 errors generated.
I can call a function without function prototpype(ignoring implicit function declaration), but why I can't get the adress of the function?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
