Disclaimer: I've read countless other articles on this topic and I still don't get them. Example: why do this:
void func(int a, void (*callback)(int))
{
/* do something with a and callback */
callback(3);
}
void pointme(int b)
{
/* do something with b */
}
int main()
{
void (*pf)(int);
pf = &pointme;
func(10, pf);
}
when I can simply do this:
void func(int a)
{
pointme(3);
/* do something with a*/
}
void pointme(int b)
{
/* do something with b */
}
int main()
{
func(10);
}
??? I really don't get it. Any help would be super-appreciated. Thanks!!!