Even with int foo(char str[]); which will take in an array initialized to a string literal sizeof doesn\'t work. I was asked to do something like strlen and the app
You cannot pass an array as a function parameter, so you can't use the sizeof trick within the function. Array expressions are implicitly converted to pointer values in most contexts, including function calls. In the context of a function parameter declaration, T a[] and T a[N] are synonymous with T *.
You'll need to pass the array size as a separate parameter.