Preview:
#include <stdio.h>
#include <stdlib.h>

int sum(int a, int b){
    return a+b;
}
void greetHelloAndExecute(int(*fptr)(int,int)){
    printf("hello user\n");
    printf("the sum of 5 and 7 is %d\n",fptr(5,7));
}

void greet(int (*fptr)(int,int)){
    printf("goodmorning user\n");
    printf("the sum of 5 and 7 is %d\n",fptr(5,7));
}

int main(){
    int(*ptr)(int,int);
    ptr=sum;
    greet(ptr);
    
    // printf("sum of 1 and 2 is %d\n",sum(1,2));
    // int(*fptr)(int,int);//declaring a function pointer 
    // fptr=&sum;//creating a function pointer
    // int d=(*fptr)(4,6);//dereferencing a function pointer
    // printf("the value of d is %d\n",d);
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter