The text[i] in (text[i] - 97) is getting converted to int when we have assigned string to it. //this part. all the others are int. How text[i] is assigning itself as int here?? if(islower(text[i])) { printf("%c", ((((text[i] - 97)+key)%26)+97));


All chars can be treated as integers. Math and other operations can be performed on them. Remember, a char is stored as an ASCII value representation, so the math char is automatically cast as an int and the ASCII value of the char is used in the operation.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .