On Mon, Mar 26, 2001 at 08:05:55PM +0100, Eamonn Martin Galvin wrote:
> > I have code that looks like this:
> >
> > char tmp[2] = {0};
Then you'd better not put a string into "tmp" that has more than *ONE*
character in it, as a 2-element array of "char" has room for a
1-character string - 1 character, plus the terminating '\0'.
> > char *tok[256]; //this contains 256 2 character strings
2-character strings as in "XY", or 2-byte strings as in "X" (1 byte of
'X', one byte of '\0')?
if it's the former, you'd better do
char tmp[3];
instead (there's no need to initialize it to 0). If you try to copy a
2-character string to a 2-element array of "char", all sorts of random
things can happen.
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list