The following is the problem code.
#include
#include
using namespace std;
void convertToUppercase(char *);
int main()
{
cha
You are trying to compare a char
to a char const*
(well, really a char const[2]
but that's just a detail). You probably meant to use
while (*sPtr != '\0')
or
while (*sPtr)
Note that your use of islower()
and toupper()
isn't guaranteed to work: the argument to these functions has to be positive but char
may have negative values. You need to first convert the char
to unsigned char
:
toupper(static_cast(*sPtr))
The test for islower()
isn't needed: on non-lower char
s toupper()
just returns the argument. Omitting the trst is improving the oerformance.