I'm trying to do a program that receives an array of characters as input and each letter is replaced by another. On the following code, I only consider one change ('a'-->'h'), but as soon as the program works for that change, I will implement the others (based, for example in Caesar's Cipher). The thing is that the program compiles successfully, however, when I run it, if I insert an 'a', he return another 'a' (and it was supposed to return an 'h'). What is wrong with the code? Thanks in advance.
#include <stdio.h>
void ciphering (char text[])
{
int i;
for (i=0; i!='\0'; i++)
{
if (text[i]>='a' && text[i]<='z')
{
if (text[i]=='a')
text[i]='h';
}
}
}
int main()
{
char text[1000];
scanf("%s", text);
ciphering(text);
printf("%s\n", text);
return 0;
}