You could compute strlen(s) once and save it in a variable. But it is not really necessary to compute strlen(s) even once. A better approach is to end the loop when s[i] is a null character.
int numNonblanks(const char* s)
{
int count = 0;
for(int i = 0; s[i] != '\0'; i++)
{
if(s[i] != ' ')
{
count++;
}
}
return count;
}