title: But the sizeof() operator doesn't work on pointer but works on the array name. Why is it so?
body: <p>Hi i was doing this exercise and wanted to get the size of array after i pass the pointer to the array to the function:</p>
  
  <p>But the sizeof() operator doesn't work on pointer but works on the array name. Why is it so? 
  Is this any way i could get the size of the array on the findPut function?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  //global vars
  int i,j;
  //functions prototypes
  void findPut(int *, int);
  
  int main(void){
      int ins=4;
      int arr[10]={1,2,3,5,6,7,8};
      printf("%d\n",sizeof(arr));     //gives 40
      int *ap=arr;
      printf("%d\n",sizeof(*ap));     //gives 4 instead of 40 why?? if ap and arr the same thing
  
  
      findPut(ap, ins);
      return 0;
  }
  
  //functions
  void findPut(int *p, int n){
      //vars
      //getting size of array
      int size= sizeof(*p);   
      //sizeof(int);
      printf("%d\n",size);        //gives 4 but expected 40????
  
  }
  </code></pre>