1) You try to use an initialization list to a char, you meant to write
r.characters= {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z'};
but this is not valid C.
edit: as pointed by WhozCraig, prefer memcpy (I forgot the null terminator with strcpy)
char chars[26] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
rotor r;
memcpy(r.characters, chars, sizeof(chars));
or
rotor r = {{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z'}, 5};
2) Use are using the -> operator on a rotor object, which is not a pointer. Replace it with "."
void rotate(rotor r) {
char aux[26];
int i;
for (i = 0; i < 26; i++) {
if (i == 0) {
aux[26] = r.characters[i];
}
else
{
aux[i] = r.characters[i + 1];
}
}
memcpy(r.characters, aux, sizeof(aux));
}
Your rotate method is suspicious. What is the intended usage ? Edit: OK