[Solved] Call function use pointer

[ad_1] First of all: Your functions void my_int_func(int x) and void my_int_func2(int y) do not return anything (return type void). They just prompt the input parameters to stdout. What you probably want is something like that #include <iostream> using namespace std; int my_int_func(int x) { return x; } int my_int_func2(int x) { return x; } … Read more

[Solved] Decoding declaration(a combination of array and function pointers) in C [closed]

[ad_1] That code is not a declaration, but it can be interpreted as an expression. (*I_dont_know())[(int) ((*ptr))] Call the function I_dont_know with no arguments. This function returns a pointer to something. Dereference the returned pointer to get some object. Meanwhile, dereference the value of ptr and cast it to an int value. Then pass that … Read more

[Solved] Function Pointers stored in global variables get set to 0 when entering function, and get back to previous state when exiting function

[ad_1] if you write in header file static PFNGLGETERRORPROC glGetError; every c/cpp have own private copy of glGetError and it not conflict with other because it static – so different cpp files use different versions of glGetError – in one cpp unit you init one version and it !=0, when you enter to another cpp … Read more

[Solved] expected ‘void (**)(void *, const char *)’ but argument is of type ‘void (*)(void *, const char *)

[ad_1] It is pretty wonky, it wants to return the default error handler. So you have to pass a pointer to a variable. Like this (untested): xmlGenericErrorFunc handler; initGenericErrorDefaultFunc(&handler); If I understand your intentions properly, this is not the function you actually want to use to suppress errors. Use xmlSetGenericErrorFunc() instead. You can use initGenericErrorDefaultFunc() … Read more

[Solved] Why exactly can’t function pointers be implicitly converted?

[ad_1] There are implicit and explicit conversions. A cast is always an explicit conversion and uses the (type) cast operator. C has quite decent type safety when it comes to pointers. Apart from the special case of null pointer conversions, the only implicit pointer conversion allowed is between an object pointer and a pointer to … Read more