Answered step by step
Verified Expert Solution
Link Copied!

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 !=

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

ISBN: 3319234609, 978-3319234601

More Books

Students also viewed these Databases questions