Hello. I haven't had much trouble with function pointers in the past, but now they are a major pain. Could anyone tell me what I am doing wrong in the below code and give a fixed version please. I get a compiler error that I will also post below. Thanks in advance.
ErrorCode:int test(int x) { return 0; } int function(char* string) { //... return test; // Returns the address of test. } int main(void) { int (*pointer) (int); pointer = (void *)function("Hello World"); //... }
How would I fix this. Its really giving me a headache. I've been trying to figure this out for hours now.Code:error: invalid conversion from `int' to `int (*)(int)'