1

What is the difference between sizeof(foo) and sizeof(foo()) where foo is any simple function. In gcc (4.7.2)
I am getting sizeof(fun) = 1 and sizeof(fun()) = 4. Earlier I perceived that foo is stored as a pointer in symbol table. Can someone explain why I am getting 1 in first case and 4 in other ?

#include<stdio.h>
int fun(){
int a=1,b=4,x=5;
printf("hi\n");
}

int main(){
printf("%d",sizeof(fun()));
}
Grijesh Chauhan
  • 55,177
  • 19
  • 133
  • 197

0 Answers0