On Thu, Jul 29, 2010 at 8:04 AM, erik quanstrom <[email protected]>wrote:
> > Thanks Erik, Sape, and Skip. That was such a STUPID error, and I thank
> > you all for the extra eyes. I think it is time for a break and a bowl of
> > tea...
>
> relax. not stupid, subtle. it takes vigilance to keep
> sizeof, nelem, strlen, and the number of characters
> straight.
>
> - erik
>
>
And you *can* use sizeof on arrays :-).
Well at least in ANSI/ISO C. Haven't tried this on plan 9. :-)
On my mac I get 6 and 8.
#include <stdio.h>
char blah [] = "Hello";
char * blah2 = "There";
int main () {
printf("sizeof blah: %ld\n", sizeof(blah));
printf("sizeof blah2: %ld\n", sizeof(blah2));
}