Is ``char c; strcpy(&c,"");'' ANSI C?
Doug Gwyn
gwyn at smoke.BRL.MIL
Fri Aug 25 07:02:51 AEST 1989
In article <30 at looney.twinsun.com> eggert at twinsun.com (Paul Eggert) writes:
> ... char c; strcpy(&c, ""); ... (1)
>is not ANSI C, because strcpy calculates (&c) + 1, violating K&R A7.6, p.205,
It's not a problem. The (proposed) C standard in effect guarantees that
every object can be considered as an array of one thing, and that it is
always legal to generate a pointer to the thing one past the last element
of any array, although it is not legal to dereference such a pointer.
More information about the Comp.lang.c
mailing list