I am trying to get this to shift ABCDE...BCDEA...CDEAB. Whats up with the program?
Can anyone tell me where my mistakes are?
Code:
#include<stdio.h>
void shift(char *p1, char *p2, char *p3, char *p4, char *p5);
void shift(&c1,&c2,&c3,&c4,&c5);
int main()
{
void shift(char *p1, char *p2, char *p3, char *p4, char *p5);
void shift(&c1,&c2,&c3,&c4,&c5);
shift(char *p1, char *p2, char *p3, char *p4, char *p5)
{
#define END_INDEX 4
int iCurrentShift = 0, iCurrentCharIndex = 0 ;
char c1='A', c2='B', c3 ='C', c4 ='D', c5 ='E' ;
char cFirstLetter ;
for( iCurrentShift = 1 ; iCurrentShift <= iShiftCnt ; iCurrentShift++)
{
cFirstLetter = letter[ 0 ]; /* save the first as we're moving something in there */
for( iCurrentCharIndex = BEGIN_INDEX ; /*if BEGIN_INDEX = 0 & its equal to currentcharindex then goto next statement*/
iCurrentCharIndex <= END_INDEX - 1;
iCurrentCharIndex++)
{
letter[ iCurrentCharIndex ] = letter[ iCurrentCharIndex + 1];
} /* end for icurrentcharindex */
letter[END_INDEX ] = cFirstLetter ;
return 0;
}