0
How to shift the character within the string in c?
ex: input: abc output : cab bca abc
2 Réponses
+ 2
Umm, I would imagine
char arr[] = "abc";
int i,j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3 - 1; j++)
{
char temp = arr[j+1];
arr[j+1] = arr[j];
arr[j] = temp;
}
printf("%s\n", arr);
}