size of a function using sizeof() always returns 1
I just tried to find the size of a function.While using sizeof() for finding the size it always returns 1.Even the function is a well defined function it just returns 1. I just wanna know why it returns 1. What actually it considers when saying sizeof(funtion).
consider a simple swap function. I used fun3 just to show the difference of addresses occupied.
void fun1(int a,int b)
{
int temp;
temp=a;
a=i;
i=b;
printf("%d\t %d\n",a,b);
}
void fun2()
{
}
void fun3()
{
}
void main()
{
printf("fun1\t Address : %d \t Size : %d\n",fun1,sizeof(fun1));
printf("fun2\t Address : %d \t Size : %d\n",fun2,sizeof(fun2));
printf("fun3\t Address : %d \t Size : %d\n",fun3,sizeof(fun3));
}
the output here is
fun1 Address : 4199248 Size : 1
fun2 Address : 4199301 Size : 1
fun3 Address : 4199307 Size : 1
The number of addresses occupied by fun1 is huge,fun2 occupies only 6.But the Size remains same for both