Please look at the code following:-
#include <stdio.h>
int sum ( int b, int a){
return (a+b);
}
int main(){
int (* funptr)( int , int ) = sum;
int a = ( * funptr )( 4,5);
int b = funptr (4,5);
printf("%d\n%d",a,b);
return 1;
}
Is there any difference between the two function calling via pointer,one is
int a = ( * funptr )( 4,5);
and another is
int b = funptr (4,5);
As i have compiled this code and result is same in both the cases.Is this means that these are equivalent?
(*funcptr)(...)form to make it explicit that I am dereferencing a pointer. Makes it clearer to the reader that it isn't a function with that actual name.