Question: Fix the error in the program. swap_nums seems to work, but not swap_pointers. As a hint, you will not need to convert anything to a

Fix the error in the program. swap_nums seems to work, but not swap_pointers. As a hint, you will not need to convert anything to a string to fix the code, but you may need to change variable types in the parameters.

Fix the error in the program. swap_nums seems to work, but not

#include using namespace std; void swap nums (int *x, int *y) { int tmp ; tmp = *x; *x = *y ; *y = tmp; } void swap_pointers (char *x, char *y) char *tmp; tmp = x; X = y; y = tmp ; int main ( ) int a, b; char *s1, *s2; a = 3; b=4 ; swap nums ( & a , & b ) ; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Physics Questions!