1

I have tested your code, including the new code you've added in your edit, and your conditions work when the arithmetic is removed. This means changing capAlph[p] == text[i] - 'A' to capAlph[p] == text[i] and smaAlph[p] == text[i] - 'a' to smaAlph[p] == text[i]. The arithmetic, as I explained in a comment, ensures that the two values will never be equal. I ...


1

They are right, your program is only checking the first character of argv[1]. Try to think - your for loop checks the first character; if its not a digit, it throws an error and ends the program. Or if its a digit, it prompts for input. So basically you are stopping the program either way just after checking the first character! What you should do instead, ...


1

As you know you've created a for loop that iterates once for each character introduced by the user of your program so, if you don't want to print printf("ciphertext: ......." for every character, you should only print the character like: printf("%c", YOURCHARVARIABLE);.


1

Is ouptut allocated correctly? It is declared here char output[strlen(i)]; as a char array, and used here printf ("ciphertext: %s\n", output); as a string. It is missing the "thing that makes a string a string", i.e. the null terminator '\0'. output 1) isn't allocated to include the null-terminator and 2) isn't null terminated.


Only top voted, non community-wiki answers of a minimum length are eligible