sizeof "string"? multi-line macro usage?
ron at brl-sem.UUCP
ron at brl-sem.UUCP
Mon Jul 14 10:04:00 AEST 1986
In article <343 at vu-vlsi.UUCP>, colin at vu-vlsi.UUCP (Colin Kelley) writes:
> Question 1.
>
> Is it (portably) legal for sizeof to operate on a string constant?
Yes, "A string is a sequence of characters surrounded by double quotes
[and] has type 'array of characters.'" and "[Sizeof] when applied
to an array, the result is the total number of bytes in the array."
Hence,
sizeof "foo"
should return 4.
More information about the Comp.lang.c
mailing list