Explore BrainMass

Explore BrainMass

    Shifting variables in a circular fashion

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Please help with the following problem.

    This needs to be in "C"

    Write 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.

    ****This needs to be in "C"*****

    © BrainMass Inc. brainmass.com March 4, 2021, 8:19 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/shifting-variables-circular-fashion-160011

    Solution Preview

    #include <stdio.h>

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

    int main()
    {
    char C1, C2, C3, C4, C5 ;
    int i ...

    Solution Summary

    This solution helps with shifting variables in a circular fashion. Step by step codes are provided in the solution.

    $2.49

    ADVERTISEMENT