In PSET2 Substitution, to display the results, I'm initializing an empty string with:
char cyphertext[] = {'\0'};
Populating it with:
// makes the substitution
for (int i = 0; text[i] != 0 ; i++)
{
if (isupper(text[i]))
{
cyphertext[i] = text[i] - 'A';
} else {
cyphertext[i] = text[i] - 'a';
}
}
But when I try to print it with:
printf("cyphertext: %s\n", cyphertext);
I get:
cyphertext:
�
I don't know where I'm making a mistake. Am I declaring it wrong? Am I "filling" it wrong? Am I printing it wrong?