Character constants
Guy Harris
guy at auspex.UUCP
Sat Mar 4 17:23:31 AEST 1989
>A simple printf("%d", sizeof('x') ); reveals that a character constant
>(at least both on sun3 and ultrix 11/780) are the same as an int (4 chars).
>Isn't it a lot easier to execute a simple test program than to try to
>look up this type of information?
Doug Gwyn indicated that one version of a C compiler delivered by one
vendor decided that
sizeof "this is a big fat string"
was the same as
sizeof (char *)
which is simply not correct. Your simple test program may give the
wrong answer if your compiler is buggy.
It may be easier to execute a simple test program, but it may not be
easier to believe the results of that program....
More information about the Comp.lang.c
mailing list