Hello, I was wondering if someone could help me with the following?
Write a function that shifts the stored value of five character variables in a circular fashion. Your function should work in the following way. Suppose that c1, c2,...,c5 are variables of type char, and suppose that the values of these variables are 'A' , 'B' , ....' E', respectively. The function call shift (&c1, &c2, &c3, &c4, &c5) should cause the variables c1, c2,..., c5 to have the values 'B', 'C', 'D', 'E', 'A', respectively. Your function definition should start as follows:
void shift(char *p1, char *p2, char *p3, char *p4, char *p5)
{
....
}
Test your function by calling it five times and printing out, in turn, BCDEA, CDEAB, DEABC, EABCD, and ABCDE.
----------------------------------------------------------------------------------------------------------------
I was wondering why the exercise calls for starting the function definition as above?
Any help would be greatly appreciated.
Thank you in advance.
Write a function that shifts the stored value of five character variables in a circular fashion. Your function should work in the following way. Suppose that c1, c2,...,c5 are variables of type char, and suppose that the values of these variables are 'A' , 'B' , ....' E', respectively. The function call shift (&c1, &c2, &c3, &c4, &c5) should cause the variables c1, c2,..., c5 to have the values 'B', 'C', 'D', 'E', 'A', respectively. Your function definition should start as follows:
void shift(char *p1, char *p2, char *p3, char *p4, char *p5)
{
....
}
Test your function by calling it five times and printing out, in turn, BCDEA, CDEAB, DEABC, EABCD, and ABCDE.
----------------------------------------------------------------------------------------------------------------
I was wondering why the exercise calls for starting the function definition as above?
Any help would be greatly appreciated.
Thank you in advance.
Comment