char *lowerCase(char *str) {
char *cp; // input string cursor
char *op; // output string cursor
char *out; // output string buffer
out = (char *)malloc(strlen(str)+1);
assert(out != NULL);
op = out;
for (cp = str; *cp != '\0'; cp++) {
*op = tolower(*cp);
op++;
}
*op = '\0';
return out; // what is the precise effect?
}
|