write a function that gets 3 pointers int* a, int* b, int* c, and rotates the values in their addresses to the left. That is, a gets the value of b, b gets the value of c, and c gets the value of a. void rotate3 (int* a, int* b, int* c);

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 19SA
icon
Related questions
Question

In C, write a function that gets 3 pointers int* a, int* b, int* c, and rotates the values in their addresses to the left. That is, a gets the value of b, b gets the value of c, and c gets the value of a.

void rotate3 (int* a, int* b, int* c);

For example,

  • if we have int x=1, y=2, z=3, then after calling rotate3 (&x, &y, &z) we should have x==2, y==3, and z==1.
  • if we have int x=7, y=1, z=6, then after calling rotate3 (&x, &y, &z) we should have x==1, y==6, and z==7.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr