I'm trying to write part of the string library myself for a class project. I'm stuck on strlwr. I can transverse the string but not sure where the char goes that i just converted. It seems that i should store it somewhere but I'm not sure how to do that or if it's even necessary. Any hints or verbal instructions would be very appreciated but pls no complete code... i need to code it myself to learn. Here is what i have so far... this is in a separate cpp file that is called by "main" cpp file through a header file.
PS - I've searched all night but it seems this is an outdated unsupported method no longer used so there isn't a lot of good info besides ppl using tolower while transversing the string to duplicate strlwr.
That is an empty statement and is equivalent to something like this: 32;. I think you meant *ptr += 32;.
*ptr++;
Here you are dereferencing a pointer that points to a char, and incrementing that char, instead of incrementing the pointer itself. Leave out the asterisk. ++ptr;
Also, you declared the function as one that returns char*, but you never actually return anything.
EDIT:
not sure where the char goes that i just converted.
strlwr changes the string passed to it directly, then returns that string. It doesn't make a new string. I assumed that's what you wanted above.
Thank you. Now I know that it changes the string itself which solves one problem. I'll make the corrections to my code (sorry after an all night trial and error marathon I lost track of some simple stuff) and play with it some more.