awesome usage of function pointers in android C/C++
I have observed some awesome usage of function pointers in android C/C++. My sample application similar to that code:
#include <conio.h>
void fn( void (*seekDoneCb)() )
{
void (*mSeekDoneCb)() = seekDoneCb;
(*mSeekDoneCb)();
}
void Seek()
{
printf("Seek()fn Called");
}
int main(int argc, _TCHAR* argv[])
{
fn(Seek);
getch();
return 0;
}
Output:Seek()fn Called
#include <conio.h>
void fn( void (*seekDoneCb)() )
{
void (*mSeekDoneCb)() = seekDoneCb;
(*mSeekDoneCb)();
}
void Seek()
{
printf("Seek()fn Called");
}
int main(int argc, _TCHAR* argv[])
{
fn(Seek);
getch();
return 0;
}
Output:Seek()fn Called
0 Comments:
Post a Comment
<< Home