Purchase Solution

Shifting variables in a circular fashion

Not what you're looking for?

Ask Custom Question

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"*****

Purchase this Solution

Solution Summary

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

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

Purchase this Solution


Free BrainMass Quizzes
Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.