I'm having trouble making a loop that would count letters of an array until it reaches the end of the array, then display the length of the largest word in that array. For example:
array[14] = { "h", "a", "p", "p", "y", " ", "b", "i", "r", "t", "h", .... }
you get the point. My question is, how can I fix this loop so it reads not only the first word, but the second word as well? Below is my version, which runs improperly.
while ( string[j] != '\0' ){
if ( string[j] != ' ' )
{
counter++;
j++;
}
else if ( counter > bignum )
{
bignum = counter;
counter = 0;
j++;
}
else
j++;
}