title: Find the Size of integer array received as an argument to a function in c
body: <p>i would like to find the size of integer array passed as an argument to a function.
  Here is my code</p>
  
  <pre><code>void getArraySize(int arr[]){
    int len = (sizeof(arr)/sizeof(arr[0])
    printf("Array Length:%d\n",len);
  }
  
  int main(){
   int array[] = {1,2,3,4,5};
   getArraySize(array);
   return 0;
  }
  </code></pre>
  
  <p>I am getting the following warning </p>
  
  <p><code>sizeof on array function parameter will return
        size of 'int *' instead of 'int []' [-Wsizeof-array-argument]</code></p>
  
  <p>Please help so that i can find the length of integer array inside the <code>function</code> <code>getArraySize</code>
  However am able to find the size of the <code>array</code> inside the <code>main</code> function.Since it is passed as a <code>pointer</code>, am not able to find the <code>length</code> from with in the <code>function</code>.</p>
  
  <p>i do have an idea though.I could put this with in a <code>try/catch</code> block(<code>C</code> does not have try catch,Only <a href="https://stackoverflow.com/questions/10586003/try-catch-statements-in-c">jumpers</a> which is OS dependent) and loop until i get a <code>segmentation fault</code>.</p>
  
  <p>Is there any other way i could use to find the length of <code>integer array</code> inside the <code>function</code></p>