I'm calculating the size of the array using following code
int arr[] = {1, 2, 3, 4, 5, 6};
int size = *(&arr + 1) - arr;
This gives me 6 as output. However, when I create a function with the same code, the size becomes -8. What could be the reason for this behaviour.
int sizeArr(int arr[])
{
int size = *(&arr + 1) - arr;
return size;
}