The title might seem it's a duplicate question. Not sure if it actually is.
Consider the code below:
# include <iostream>
size_t arrSize(const int* arr)
{
return *(&arr+1)-arr;
}
void foo(int* arr)
{
std::cout << arrSize(arr);
}
int main()
{
int arr[]{3, 6, -9, 52, -68};
foo(arr);
return 0;
}
It prints 4294967293 in my machine. I was expecting 5. I want an in-depth answer.