I find a bit funny that nobody used recursive solution, which can fit one line as well
size_t strlen_rec(const char*str) { return *str ? 1+strlen_rec(str+1) : 0; }
but its not tail case recursive, so stackoverflow is guaranteed