From: Paul Harness Subject: strcpy() bug? To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Date: Tue, 8 Mar 1994 15:39:40 +0000 (GMT) The following program: #include #include int main(void) { char *element1[]={"length","length"}; char element2[2][6]; char *text = "text"; strcpy(&element1[0][0], text); printf("%s %s\n", &element1[0][0], &element1[1][0]); strcpy(&element2[0][0], text); printf("%s %s\n", &element2[0][0], &element2[1][0]); return 0; } produces the output: C:\STU>gcc -Wall test.c C:\STU>go32 a.out go32 version 1.11.maint3 Copyright (C) 1993 DJ Delorie text text text Whereas if *element1[] is initialised as: char *element1[]={"length","short"}; the outputs from the two printf() statements are identical. i.e. when the two strings are the same, strcpy() appears to copy `text' to &element1[0][0] AND &element1[0][1]. This does not occur with MS and Borland C. Any ideas? -- Paul Harness and Stuart Young, | Internet: gapa83 AT udcf DOT gla DOT ac DOT uk Department of Physics and Astronomy, | University of Glasgow, | Tel +44-41-339-8855 ext 8359 Glasgow, G12 8QQ, SCOTLAND. | Fax +44-41-334-9029