I have copied some code from the book to complie. Anyway, i am trying to copy this code that must use the function call void shift(&c1,&c2,&c3,&c4,&c5);. The function should shift letters ABCDE next BCDEA...etc...etc....
This is what i had copied so far
Code:
#include<stdio.h>
int main()
{
void shift(char *p1, char *p2, char *p3, char *p4, char *p5);
void shift(&c1,&c2,&c3,&c4,&c5);
return 0;
}
void shift(char *p1, char *p2, char *p3, char *p4, char *p5)
{
#define c1 ='A', c2 ='B', c3 ='C', c4 ='D', c5 ='E'
#define END_INDEX 4
int iCurrentShift = 0, iCurrentCharIndex = 0 ;
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 ;
} /* end for icurrentshift */
} /* end function */
what have i done wrong?