sizeof() on constant strings

Andrew Bartlett abartlet at
Mon Sep 1 23:18:14 MDT 2014

Just a hint I found out the hard way recently:

char *foo = "ba";
char foo[] = "ba";
give different results when you do sizeof(foo).  See attached test

Andrew Bartlett
Andrew Bartlett
Authentication Developer, Samba Team
Samba Developer, Catalyst IT

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 339 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list