Functions accept their arguments by value.
That is the function swap (for which you forgot to specify the return type void)
void swap(char *t1, char *t2) {
char *t;
t = t1;
t1 = t2;
t2 = t;
}
deals with copies of values of the expressions ptsr[0] and ptsr[1]. Chamging the copies does not influence on the original pointers.
You may imagine the function definition and its call the following way
swap(ptsr[0], ptsr[1]);
//...
void swap( /*char *t1, char *t2*/) {
char *t1 = ptsr[0], *t2 = ptsr[1];
char *t;
t = t1;
t1 = t2;
t2 = t;
}
As you can see the variables and ptsr[0] and ptsr[1] were not be changed.
To change an object (that in particularly can have a pointer type) in a function you need to pass it to the function by reference.
In C passing by reference means passing an object indirectly through a pointer to it.
So the function swap will look like
void swap(char **t1, char **t2) {
char *t;
t = *t1;
*t1 = *t2;
*t2 = t;
}
and the function must be called .like
swap( &ptsr[0], &ptsr[1] );
Or as the same
swap(ptsr, ptsr + 1);
Dereferencing the pointers to pointers t1 and t2 the function gets a direct access to the original pointer ptsr[0] and ptsr[1] swapping their values.
int, what do you thinkswap(1,2);would do?