My first doubt is:
Is the name of function a pointer variable and Which variable's address is the pointer holding ? (in this program which variable's address addition pointer holds).
AND if i write '&' before addition, program runs fine. Is compiler automatically add '&' during compilation ???
#include<stdio.h>
int addition(int, int);
int main()
{
int (*p)(int, int);
int sum;
p=addition; // if I add '&' before function name the
//program runs fine. (&addition).
sum=p(10, 20);
printf("Sum is %d\n", sum);
return 0;
}
int addition(int x, int y)
{
int r;
r=x+y;
return r;
}
Output is: Sum is 30.