From: Mathieu Bouchard Date: 2001-06-08T11:30:10+09:00 Subject: [ruby-talk:16313] Re: Little bug in the manual > I think there is a little error in ruby's guide > ( www.ruby-lang.org/en/pdf-doc/rubyguide_A4.pdf ) > Look at page 16, the C example of a loop, quoting: > char *str; > for (str = "abcdefg"; *str != '\0'; str++) { > /* process a character here */ > } > I think 'str = "abcdefg"' isn't legal, and should be replaced with > strcpy(str, 'abcdefg'); > That's it, nothing important, but may be worth fixing in the next release of > the guide. Not only str="abcdefg" is legal and working, but your replacement has several errors in it. Please learn the difference between a character literal and a string literal; and then learn about initializing all your variables; then learn about the use of memory allocation and deallocation; then learn how you can fix your code; then learn why the original code can be right too. That's it, nothing important, but may be worth learning for your next post about C code. matju