I was reading a wikipedia article on Trimming and saw this implementation of ltrim (left trim)
char *
ltrim(char *str)
{
char *ptr;
int len;
for (ptr = str; *ptr && isspace((int)*ptr); ++ptr);
len = strlen(ptr);
memmove(str, ptr, len + 1);
return str;
}
Would bad things happen if I skip memmove and return ptr isntead?
char *
ltrim(char *str)
{
char *ptr;
int len;
for (ptr = str; *ptr && isspace((int)*ptr); ++ptr);
return ptr;
}