how does the loop works

especially the the loop part
void encode (char *cat)
{
char orig[] = "abcdefghijklmnopqrstuvwxyz";
char cipher[] = "bpduhijkaltxwmrzfoysvngeqc";
char *copy;
int i;

// Loop through the plaintext a character at a time.
// and encode it. If no ciphertext character is found,
// leave the character as it is.
[b]for (copy = cat; *copy != '\0'; copy++)
{
for (i = 0; i < 26; i++)
{
if(*copy == orig[i])
{
*copy = cipher[i];
break;
[/b]}
}
}
}

int main()
{
char cat[10];
printf("Enter The word you want to encrypt:\n");
scanf("%s",cat);

encode(cat);
printf(" ENCRYPTED: %s\n",cat);
return (0);
What exactly you want to understand? is there some problem with the code, the code giving wrong results or something else ?
Topic archived. No new replies allowed.