+ 3
What is value of a in the given code
Does Swapping reference, swaps values inside? https://code.sololearn.com/ccxDZ6fqcpiN/?ref=app
1 Answer
+ 3
You swap pointers, not values, inside the function, so no change occurs outside. In order to swap values there should be something like
int t = *ptr1; *ptr1 = *ptr2; *ptr2 = t;