I tried this code
1 #include <stdio.h>
2
3 int sum(int a,int b)
4 {
5 printf ("\nFun sum called");
6 return a+b;
7 }
8
9 int main()
10 {
11 int a=5;
12 int b=6;
13 printf("\n 1. %d",sum(a,b));
14 printf("\nAddress of sum : %p",&sum);
15 int (*fptr)(int,int) = NULL;
16 fptr = ∑
17 printf("\n 2. %d",fptr(a,b));
18 printf("\nAddress of fptr is %p and fptr is %p",fptr,*fptr);
19 return 1;
20 }
and my output was
Fun sum called
1. 11
Address of sum : ***0x400498***
Fun sum called
2. 11
***Address of fptr is 0x400498 and fptr is 0x400498***
Why is it that the address of function pointer and content held by the address inside function pointer appear to be the same?
They should be different! Am I missing something?