As other answers have pointed out, it is not possible to determine the size of an array inside of a function in the general case, i.e. without assumptions.
If this is really about returning the size of an array from a function at any cost, I chip in the general method of determining the length based on special knowledge/assumptions on the CONTENT of the array. This is how the strlen()
function determines the length of NULLTERMINATED character sequences, which is the closest thing C has to string.
The special assumption on the content of the character sequence is that they only contain the terminating '\0'
at the end. Many a StackOverflow question was asked because of the traps and vulnerabilities involved in that concept causing misunderstandings.
So, if you can for example assume that the array in question only contains non-negative integers (i.e. positive values and 0) and that the last valid value inside the array, at index (size-1), is negative, then you can determine the length of the array by search for that terminator, i.e. the first negative value you find at or behind the address from the pointer parameter.