Create a function shifts the stored value


Discuss the below in C:

Q: Create a function that shifts the stored value of five character variables in a circular fashion. Your function should work in the following way. Suspose that C1, C2, C3, C4, C5 are variables of type char, and suspose that the values of these variables are 'A', 'B', 'C', 'D', 'E', respectively.

The function call shift(&c1,&c2,&c3,&c4,&c5) should cause the variables C1, C2, C3, C4, C5 to have the values 'B', 'C', 'D', 'E', 'A', respectively.

The function definition starts as follows:

void shift(char *p1, char *p2, char *p3, char *p4, char *p5)
{

Test the function by calling it five times and printing out, in turn, BCDEA, CDEAB, DEABC, EABCD, and ABCDE.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a function shifts the stored value
Reference No:- TGS01936264

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)