Question: Suppose we have a function with the following function signature: void swap ( int , int ) ; and in main we have local variables

Suppose we have a function with the following function signature:
void swap(int, int);
and in main we have local variables x, y, both of type int. Then, because C has pointers, it's possible to call swap(x, y) and swap the values of x and y inside our function and then see these changes in main once we return from swap.

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 Programming Questions!