I'm trying to perform case insensitive strcmp on two C-style strings.
I have a function to convert C-style strings to lowercase.
char* ToLowerCase(const char* str)
for (int i=0; i<strlen(str); ++i)
buffer[i] = char(tolower(str[i]));
You return a pointer to a variable that's local to
ToLowerCase, the pointer will point to garbage after the call, resulting in undefined behaviour when trying to dereference the pointer. Either change the
str itself or dynamically allocate the memory for