I'm trying to scroll through a list of cstrings and if they end in an 's' I want to replace it with a '\0' the problem is somtimes it catches the word and corrects it for a comparison, but other times it doesn't

 while (ptr != NULL)
       if(ptr[sizeof(ptr)] == 's')
           ptr[sizeof(ptr)] = '\0';
           ptr = ptr;
          (binarySearch(dictionary, ptr) == false);// ? cout << ptr << " misspelled on line " << line << endl: cout << "" << endl;
        ptr = strtok(NULL," ;.");


Input file:
Razors pain you;
Rivers are damp;
Acids Stain you;
And drugs cause cramp.
Guns aren't lawful;
Nooses give;
Gas smells awful;
you might as well live.

out put:

word:razors last char r

word:rivers last char r

word:guns last char

word:nooses last char e

Process returned 0 (0x0) execution time : 0.734 s
Press any key to continue.

I feel like I've asked too many questions today, but this one is killing me, I've hit a point where I'm clueless (more than usual) there's no leading or trailing white spaces, delimeters or any other folderal encumbering these words, but on some words it hiccups, and is you look at 'guns' it doesn't anything. Any explantion for this inconsistancy in lengths?

3 Years
Discussion Span
Last Post by vmanes
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.