Re: Return pointer from function



Liviu <oli...@xxxxxxxxx> wrote:
Say i have afunction:

char *rmtrail(char *str)
{
if (str)
{
int i;

for (i = strlen(str) - 1; i >= 0 && isspace(str[i]); --i)
;
str[++i] = '\0';
}

returnstr;
}

This function invokes undefined behavior when called with a whitespace-only
string.


.



Relevant Pages