total space of a string (was: hardcoded constants)
George Kyriazis
kyriazis at rpics
Wed Dec 21 15:31:42 AEST 1988
In article <1827 at solo11.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>barmar at think.COM (Barry Margolin) writes:
>\1) When I've done this in other languages, I've used something like
>\strlen("/") instead of the 2. Unfortunately, in C I'd still have to
>\say "+1", ....
>
>How about the following?
>
> sizeof "/"
"/" is a pointer to a string containing a '/' and a '\0'. Therefore
it seems to me that sizeof "/" will return the same value as
sizeof( char * ).
Comments??
George Kyriazis
kyriazis at turing.cs.rpi.edu
kyriazis at ss0.cicg.rpi.edu
------------------------------
More information about the Comp.lang.c
mailing list