Passing array in function

when we passing an array in a function why we passing with along their size also.
why always??
why the ans is different if we find array size in function??

hi @ankit_verma

In C++, array parameters are treated as pointers (as they are pass by reference).
So the expression sizeof(arr)/sizeof(arr[0]) becomes
sizeof(int *)/sizeof(int) which results in 1 for IA 32 bit machine (size of int and int * is 4)

i hope this is helpful