i am confused! are all of the following printf's the correct way to print the addresses of functions? Let me tell you my confusion as well. Everytime i run all of these printf's (that is, 1st printf, 2nd printf and 3rd printf), in output i get 02D4 02D4 02D4 but if i remove or comment of 1st and 2nd printf, i get folowing as output 02BA when i remove third printf statement, i am getting following output 02D0 Again when i uncomment all of these three, i get: 02D4 02D4 02D4 Why is one statement affecting the output of other printf line? Is this not really the address of function? I have heard that s and &s give the same value that is address (just like arrays). but here i am confused why s and &s are affected when i try to print b also, where b=s or &s.
#include<stdio.h>
#include<conio.h>
int s(int);
void main()
{
int a=10,*b;
clrscr();
b=s(a++);
b=&s;
printf("%p\n",s); // 1st printf
printf("%p\n",&s); //2nd printf
printf("%p\n",b); //3rd printf
getch();
}
int s(int x)
{
return x;
}