I am a newbie and trying to write a program that shifts letters in a circular fashion 5 times (ie: first line ABCDE, second line EABCD, third line DEABC, etc) using the following function definition:
void shift(char *p1, char *p2, char *p3, char *p4, char *p5)
First a question. What does the char *p1, etc represent?
I know the function is calling a char but I don't understand what the '*' in from of the p1 signifies.
Thanks for any help.
Here's the basic code without the functon:
Code:
#include <stdio.h>
void shift(char *p1, char *p2, char *p3, char *p4, char *p5);
char main(void)
{
char c1='A',c2='B',c3='C',c4='D',c5='E';
int cnt=0;
printf("%c%c%c%c%c\n",c1,c2,c3,c4,c5); /*prints ABCDE*/
if(cnt<=5){
shift(&c1,&c2,&c3,&c4,&c5);
printf("%c%c%c%c%c\n",c1,c2,c3,c4,c5); /*prints each
line 5 times shifting the characters*/
cnt++;
}
else
return (0);
}
void shift(char *p1, char *p2, char *p3, char *p4,char *p5)
{
?????????Here's where I am stuck
}