#include<stdio.h>
void swap (char *x, char *y)
{
char *t = x;
x = y;
y = t;
}
int main()
{
char *x = "geeksquiz";
char *y = "geeksforgeeks";
char *t;
swap(x, y);
printf("(%s, %s)", x, y);
t = x;
x = y;
y = t;
printf("n(%s, %s)", x, y);
return 0;
}
I would expect that the original pointers would swap but it isn't the case here even though i pass the pointer to the function, The reason for it is that it makes local pointers ? How do i swap the original pointers using the function?