You answered your own question. It's computed at compile-time, so how can 'sizeof p' possibly have more than one value during runtime?
Passing the length as a parameter is a fine solution, otherwise you can make sure your arrays always end with some special value (like strings and the null byte).