So I have a code sample in Dev C++ in which I am trying to swap the values of s1 and s2 and print it out but somehow, the values doesn't change. I checked the function and it displays the proper values correctly, but when in the main, the values does not change.
void swap_pointers(char *x,char *y){
char *tmp;
tmp = x;
x = y;
y = tmp;
printf("%s\n",x);
printf("%s\n\n",y);
}
int main()
{
char *s1, *s2;
s1 = "I should print second";
s2 = "I should print first";
swap_pointers(s1,s2);
printf("-AFTER SWAPPING-\n\n");
printf("s1 is %s\n",s1);
printf("s2 is %s\n",s2);
return 0;
}