Write and test the following function void rotateint a int


Write and test the following function: void rotate(int a[], int n, int k);

The function "rotates" the first n elements of the array a, k positions to the right (or -k positions to the left if k is negative). The last k elements are "wrapped" around to the beginning of the array. For example, the call rotate(a,8,3) would transform the array {22,33,44,55,66,77,88,99} into {77,88,99,22,33,44,55,66}. The call rotate(a,8,-5) would have the same effect.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write and test the following function void rotateint a int
Reference No:- TGS01186613

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)