Putc?

Can someone explain:

putc ?.

and

putc “.”?

It seems to me that they have the same effect. But I don’t quite
understand the first one.

Thanks in advance.

?. is a character constant, like ‘.’ in C. “.” is a one-character string containing a ‘.’ - so given
foo = ?.
bar = “.”
baz = “.”

bar == baz (escaping normal characters with 's inside “” does nothing to them)
bar[0] == baz[0] == foo == ?. == 46

All the character constants start with ?, so e.g. ?A == 65.
(you can’t use ‘’ for character constants since it’s already used for strings)

···

On Fri, 27 Dec 2002 17:10:05 +0900 zhoujing@comp.nus.edu.sg (TOTO) wrote:

Can someone explain:

putc ?.

and

putc “.”?

It seems to me that they have the same effect. But I don’t quite
understand the first one.

Thanks in advance.

Doubt is a pain too lonely to know that faith is his twin brother.

  • Gibran Khalil Gibran