Function which is returning pointer to function in c programming.

#include <math.h>
double (*lic())(double);
double(*p)(double);
void main(){
    p=lic();
    clrscr();
    printf("%.2lf",(*p)(M_PI_4));
    getch();
}
double (*lic())(double){
       p=&sin;
       return p;
}
Output:0.71

ONE MORE EXAMPLE:






float calculate();
float (*show())();
void main(){
float b;
clrscr();
b=(*show())();
printf("%f",b);
getch();
}
float calculate(){
float a=5.5;
a+=5<=5;
return a;
}
float (*show())(){
return calculate;
}
Output: 6.5000000

No comments: