While Patrice T is right, it is possible - but to do it you start complicating your code.
Because calling by value (the default for C) always passes a copy of a parameter any changes you make to that variable inside the function aren't reflected in the outside world - which is a very good thing! Image if you passed everything by reference:
void Double(int x)
{
x = x * 2;
}
Then call it:
int val = 666;
Double(val);
printf("%u", val);
Will print what you expect: 1332
But that's not the only way you could call it:
Double(666);
printf("%u", 666);
What should that print? 1332? 666? If it's the first, then your code is going to get really confusing, really fast! And if it's second ... what happened to the function call?
So parameters are passed by value, not by reference, so the only way to influence the outside world is by passing a copy of the address of the value and then the function can change its value.
void Double2(int* x)
{
*x = *x * 2;
}
int val = 666;
Double2(&val);
printf("%u", val);
Will print what you expect: 1332
And
Double2(&666);
printf("%u", 666);
Will not compile as you can't take the address of a constant value.
Which leads us back to your problem: with pass by value, how do you swap two pointers?
Simple: you pass a pointer to the pointer to the char:
void swap(char **str1, char **str2)
{
char *temp = *str1;
*str1 = *str2;
*str2 = temp;
}
And then you pass the address of the pointer:
char *str1 = "geeks";
char *str2 = "forgeeks";
swap(&str1, &str2);
printf("str1 is %s, str2 is %s", str1, str2);
Make sense?