Returning the original pointer allows you to include your function as part of a statement, for example:
Code:
printf("%s\n", removespaces("this is a test"));
will print "thisisatest".
In your original code example, s2 isn't needed and every occurrence of s2 in your program could be replaced with s1 and it would still work.
As Adak mentioned, if you were supposed to just use pointers without indexing, then you would need s2, and you'd also need another pointer to preserve the original input pointer. Here's a partial example of this method, but missing the part you're probably supposed to figure out as part of your assignment:
Code:
char *removespaces(char *s0)
{
char *s1 = s0;
char *s2 = s0;
while(*s1){
if(' ' != *s1)
/* you fill in this part */
}
*s2++ = 0;
return s0;
}