As for function pointers, I'm not sure what you've asking for specifically.
We pre-define our function pointer types with typedef declarations, such as:
Code:
typedef void (*APF)(unsigned char *); // ptr to funct with pointer parameter
typedef void (far *PF)(void); // ptr to funct
typedef void (*cmdPF)(int,char *); // ptr to funct with (int,*char)
As you can see, each possible combination of return type and parameter list will result in a different type of function pointer, much like the difference between an int pointer and a float pointer. IOW, the type of pointer that it is determines how the compiler will use it.
{ABE: This matter of the type of pointer determining how the compiler will treat it is more important that may appear. For example, how you interpret a dereferenced pointer depends on what type it points to. When you increment a pointer, the number of bytes that gets added to that address depends on the sizeof of the pointer's datatype. But it's even more important with function pointers because in order to prepare a call to a function, the compiler has to insert a lot of code to prepare for that call (which is a simple jump while saving the return address), including code to process that function's arguments (eg, how many, what type, how to evaluate the argument, where to store it on the stack so that the function's code knows where to find it); that kind of set-up code is called
thunk code, as I was taught. Because of all that, different function pointers (ie, having different return types or different argument list item number and types) are very incompatible with each other. }
In the three examples, the type names are APF, PF, and cmdPF. Then when you use a function name, it's interpreted as a pointer to that function, the memory address that that function starts at. For example, we have several tens of commands that are processed by functions that are declared the same way as cmdPF. So we declared a struct of two fields: a char array of the command name and a cmdPF that points to the function that processes that command. And we construct an array of that struct and into each entry we pair up a command name with the name of the function that we will call to process that command -- that kind of an array is called a
jump table. Then when we receive a command, we search for its entry in the jump table and we call its function thus:
(*CmdTbl[i].CmdFunct)(port,Cmd);
CmdTbl is the jump table, CmdTbl[i].CmdFunct is the function pointer in the i'th entry in that table, and with that asterix we're dereferencing the pointer with the argument list following it.
If you can, get hold of a copy of Schaum Outlines'
Programming in C by Byron Gottfried. Chapter 10 is on pointers. At the end of that chapter, pages 323 and 324, there's a list of 20 different kinds of pointer declarations. That alone is worth the price of the book ($16.95 US), though the rest of the book is also a very good reference.
There's also a classic book entirely about C pointers. And somebody's signature on this forum has a link to an on-line resource that's "all about pointers", as I recall. You could even use Google to find examples.