So I have an array : isbn[20][20]

and then i input : 978-0-306-4061

then i try to multiply the first character, 9, by one :

s = isbn[0][0] * 1;

and instead of 9 i get.. 56.. i don't get why.

Any ideas?

Thanks

Printable View

- 03-04-2010me77array multiplication odd output
So I have an array : isbn[20][20]

and then i input : 978-0-306-4061

then i try to multiply the first character, 9, by one :

s = isbn[0][0] * 1;

and instead of 9 i get.. 56.. i don't get why.

Any ideas?

Thanks - 03-04-2010hk_mp5kpdw
The ascii value for the representation of the char '9'. (Although according to asciitable.com it's 57 not 56).

If you want to convert that to the numeric value of 9 then you'd need to subtract char '0' first. - 03-04-2010me77
ah yes, you're right its actually 57. so there's no way of just normally adding or subtracting array values?