what's the point of having something like this:
Code: Select all
char * strcat ( char *dest, char *orig ) {
int i, len;
for (i=0,len=strlen(dest);orig[i]!='\0' ;i++,len++) {
dest[len] = orig[i];
}
dest[len] = '\0';
return dest;
}
What I don't understand is: why is there a return type and a return if we are changing the variable (since it's memory reference is passed to the function).
Changing that to void (no return) does the same thing.
Why is the first one better?
Thanks.