How can I shift characters in a string to the right? For Example I want to shift every letter of "Hello" 3 times to the right. The ending letter starts at the beginning. So the output should be "lloHe".
I tried to do it with a pointer. But the output is just "k". The program just takes the "h" from the hello and shifts it 3 digits to the right from the alphabet. But thats not what I intended to do. Any tips you can give me?
#include <stdio.h>
int main () {
int a[5] = {'h','e','l', 'l','o','\0'};
char i;
char ptr;
ptr = a;
printf ("%c\n",ptr+3);
return 0;
}