Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Starter Code: #include void swapIncre(int*, int*, int*); int main( ) { int a, b,c; // Input three integers scanf(%d %d %d, &a, &b,&c); while(a !=
Starter Code:
#include
void swapIncre(int*, int*, int*);
int main( ) { int a, b,c;
// Input three integers scanf("%d %d %d", &a, &b,&c); while(a != -1) { printf("Original inputs: a:%-4d b:%-4d c:%-4d ", a, b,c); swapIncre(&a,&b,&c); //pass the reference to the variable printf("Rearranged inputs: a:%-4d b:%-4d c:%-4d ", a, b,c);
//read again scanf("%d %d %d", &a, &b,&c); }
}
void swap(int *x,int*z){ }
void swapIncre(int *x, int *y, int *z){ //receive the reference to variable as pointer int temp = *x; *x = *z; *z = temp;
*y *= 2; }
Modify program lab5A.c, by defining a new function void swap (...) which swaps the values of a and c. This function should be called in function swapIncre. Specifically, swap Incre ( ) only increases the value of b, and delegates the swapping task to swap ( )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started