Consider a ordinary code:
#include <stdio.h>
int x;
int func(int a){
x++;
return a;
}
int main(){
int a = 1;
int n = func(a);
printf("x = %d, n = %d", x, n);
return 0;
}
It will print x = 1, n = 1
as expected.
But if I slightly edit the code as follows:
#include <stdio.h>
int x;
int func(int a){
x++;
return a;
}
int main(){
int a = 1;
int n = func;
printf("x = %d, n = %d", x, n);
return 0;
}
With the function not properly written, the complier does not report an error but prints x = 0, n = 4199760
instead.
What happened to the program?
Does the name of the function have any speical meanings?
Thank you.