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 can't use sizeof here. In C arrays are decayed to pointers when passed to functions, so sizeof gives you 4 or 8 - size of pointer depending on platform. Use strlen(3) as suggested, or pass size of the array as explicit second argument.