No comments yet.
More on function pointers
This article is a follow up to: Introduction to using function pointers in C (or C++)
There’s a trick make life a bit easier when dealing with function pointers. We can typedef the function. In the previous article we used a feedback function. Let’s take it from there.
We prototyped our feedback function like this:
int (*feedback_fun)(char *str) ;
Instead we can create a new type of function like the above by using typedef like this:
typedef int (*feedback_ptr)(char *str);
Doing this we can make the function declarations look nicer. We can declare a variable holding a pointer to the feedback functions like this:
feedback_ptr feedback_fun ;
Nice isn’t it? But we haven’t won that much. We have to wait until we dive into plugins until we see the benefits if this.
Me elsewhere ..
Pages
Fatal error: Call to undefined method WP_Error::__destruct() in /www/hesa/wordpress/wp-includes/default-widgets.php on line 735
![[FSFe Fellow]](http://www.rejas.se/images/fsfe_fellow_badge_small.png)