ascii code

Nov 28, 2009 at 6:30pm
if c is a capital letter and c is from type char

what is the meaning of this expression?

(int)(c -'A')
Nov 28, 2009 at 6:43pm
You mean (int)('C' - 'A) and not (int)('c' - 'A') right?
Nov 28, 2009 at 6:46pm
no i mean like i wrote

c is a variable that contains an unknown capital letter
c is from type char
Nov 28, 2009 at 7:31pm
someone?
Nov 28, 2009 at 7:38pm
as in ascii code all capital letters are continuous ('A'==65, 'B'==66..., 'Z'==90), the meaning of (c -'A') is the index of the letter in c in the alphabet.
Nov 29, 2009 at 3:35pm
It gives the offset from A. So if c = A, the value is 0, 1 for B, 2 for C, all the way up to 25 or Z.
Topic archived. No new replies allowed.