I do not know why but when I run my program with k = 6 and I type z I get the weird character �
Here is my code:
s[i] = s[i] + k; if (s[i] > 122) s[i] = (s[i] % 26 + 78);
example with 5 as k
(~/Dropbox/pset2): ./caesar 5 z e
example with 6 as k
(~/Dropbox/pset2): ./caesar 6 z �
I have made a test program to check this and it gives the correct ASCII code for the letter f (102).
int y = 128 % 26 + 78; printf("%i\n", y); (~/Dropbox/pset2): ./test 102
Thank you in advance!