In the case of the cast, all it does is change the type (basicly saying "Yes, I know you, the compiler, thinks it's a char **, but I say now that it's a void **") - it doesn't change the value, just what type it is.
You can do "void *p = (void *) 1000;" - this casts the integer 1000 to a void pointer - so p would have the value 1000.
Function pointers are variables that hold the address of a function. A function name is an identifier of a function - it "is" the address of the function, just written with words - it would be hard to remember which is which if you have functions "called" 1234, 1243 a 1324 for example.
So if we have a function called "abc", that has the address of 1234, and a function pointer called "fp", this is what the code would look like:
Code:
void (*fp)(void);
void abc(void)
{
/// ... do something useful here ..
}
...
int main(void)
{
...
fp = abc; // This sets fp to the value 1234 (address of abc).
fp(); // calls abc.
(*fp)(); // alternative stype for fp();
abc(); // call abc directly.
// All of the above three lines do exactly the same thing.
}
--
Mats