I am studying programming language principles and I have a question with C and C++.
int (*f)(int);
int (*g)(int);
int (*h)(char);
f = g; // ok
h = g; // warning in C, error in C++
Assigning g into f (f = g) will not cause an error in C or C++, but assigning g into h (h = g) would generate a compiler warning in C and compile error in C++.
I heard that the char type is usually auto-casted into int in C++, so I thought this would not cause an error.
Can someone explain this to me?