Thursday 29 September 2011

Function Pointers The art

Function pointers can be used in complex programming situations. Function pointers Speed Up the call of functions. The address of the function is passed to the function pointer.
The following steps are helpful to understand function pointers
1. Declare the function pointer identical to the function it would refer. Dont skip to bracket the pointer and the pointer name.  void (*fp)(void ).
2.  Assigne the name of the function to the function pointer variable.
3.   Pass the values to the function pointer.

Refer the example for reference


int add(int a, int b)
{
return a+b;
}

int sub(int a, int b)
{
return a>b?a-b:b-a+ add(a,b);
}

void main()
{
int (*fun)(int , int);
fun=add;
cout<<fun(10,20)<<endl;
fun=sub;
cout<<fun(10,20);
}


Write your queries , will reply if i can sort.

Apache Beam Learning In Java Tutorials

 Wow  https://youtu.be/9kGETU63rkc