Richard Heathfield <rj*@see.sig.invalidwrites:
Ben Bacarisse said:
>mdh <md**@comcast.netwrites:
>>May I ask the learned board this. Is it correct to assume that a
character (in this case "c") is always converted to an integer, so
that line 2 below ( specifically c - '0' ) will always give the
value as an integer of it's digit representation?
In your case, c is already an int
To be excruciatingly pedantic, c /would/ be an int if he'd written it as
'c'. What he actually wrote - "c" - is a you-must-not-modify-this array of
two char with static storage duration.
To be slightly less excruciatingly pedantic but slightly more
excruciatingly correct, the code fragment being discussed, and quoted
in the article to which you responded, included the following
declaration:
int c;
The quotation marks in
(in this case "c")
were ordinary natural-language punctuation, not C string literal
delimiters.
(This is why I usually use ``this form'' when I want to quote C code,
unless I can use "quotation marks" without ambiguity.)
Let me think, what's the phrase? Oh, yes. Nyaah nyaah. Terribly
sorry, but you left me with no other choice.
--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"