void fun1(char *s1, char *s2) {
char *temp;
temp = s1;
s1 = s2;
s2 = temp;
}
int main () {
char *str1 = "Hello", *str2 = "there!"
fun1(str1, str2);
printf("%s %s", str1, str2);
return 0;
}
Given the code above, from my understand we pass the pointers by value, so if for example the values are str1 = 1000, str2 = 2000, fun1 switches them around, so str1 = 2000, str2 = 1000. So when we are trying to print them, we should get "there! Hello", but the answers says that it prints "Hello there!" and I don't understand why.. by switching them around str1's value should be the memory adress of the first character of "there!" and str2 of the first character of "Hello".. I feel like I'm missing something important..