0

I got the following error while checking my pset5.

:( handles possessives properly
   \ expected output, but not "\nMISSPELLED WORDS\n\n\nWORDS MISSPELLE..."
:( handles substrings properly
   \ expected output, but not "\nMISSPELLED WORDS\n\nca\n\nWORDS MISSP..."

I feel like it's something inside my check function that cause this issue but I fail to find the error. Can someone of you help me finding the issue.

Here's the first part of my check code:

bool check(const char* word)
{

//create a temporary storage for the words
char temp[LENGTH + 1];

//convert every charachter in lowercase
for (int i=0, n = strlen(word); i < n; i++)
{        
    if (isalpha(word[i]))
    {
        temp[i] = tolower(word[i]);
    }

    else
    {
        temp[i] = word[i];
    }
0

Given the length of temp, did you remember to insert the end of string char at the actual end of the word?

You might also consider making the length of temp = strlen(word) +1.

If this answers your question, please click on the check to accept. Let's keep up on forum housekeeping. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .