calling functions using pointers
i was once told that you can call a function using a pointer to that function.
can anyone help me understand how it works? thanx.
Re: calling functions using pointers
"imran" <email@example.com> wrote:
>i was once told that you can call a function using a pointer to that function.
>can anyone help me understand how it works? thanx.
typedef int (*myintchartype) (char *, char *);
typedef void (*myvoidtype) (void);
typedef int (*myintvoidtype) (void);
int func1(char *, char *);
ptr = (myintvoidtype) func1;
((myintchartype) ptr)("one", "two");
ptr = (myintvoidtype) func2;
int func1(char *a, char *b)
return printf("func1 took two parameters: %s and %s\n", a, b);
printf("func2 did not take any parameters\n");
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL