I'm getting an undeclared identifier error for the i in word[i] in the last of the 'do-while' loop. (word[i]) was accepted previously in the for loop as it is defined in the get-string at the top of the code(not shown here). For some reason it is not recognised in the do-while loop outside of the 'for' loops. I have tried defining it again in various parts of the code even immediately outside and inside the 'do' but then error says the definition is overshadowed by the previous one in the 'get_string'. The 'do-while' loop needs to iterate at the same time as the two internal 'for' loops so both internal 'for' loops and the 'do while' loop need to access the same (word[i]). I would appreciate advice. I can add more original code if the question is unclear. I have edited to avoid spoilers.
I would like to use my existing code, if possible, rather than use someone else's, as I know the internal 'for' loop works perfectly as it was the one I used for Caesar.
do //loop to iterate through the letters in the key
{
for(int l=0; l<strlen(key); l++) //iterate over letters in key
{
int num=l;
for(int i=0; i<strlen(word); i++) //iterates through key word entered by user
{
if(isupper(word[i])) //if original characters are uppercase
{
int cipher = (word[i] + num -65) % 26 + 65;
printf("%c", cipher);
}
(I REMOVED CODE HERE DUE SPOILERS)
else //all other types of characters
{
printf("%c", word[i]);
}
}
}
printf("\n");
}
while((word[i])<strlen(word));
}
}