From: Daniel Martin Date: 2007-04-24T11:34:24+09:00 Subject: Re: Question regarding design of the String Class One small nit: "Rick DeNatale" writes: > the expression str[i] is equivalent to *((str) + (i)), it's really a > pointer to a char, which because of the relationship between arrays > and pointers in c, can be interpreted as an array of chars. No. str[i] is indeed equivalent to *((str) + (i)), but that's not a pointer to a char. ((str) + (i)) is a pointer to a char. *((str) + (i)) is a char. *((str) + (i)) cannot be interpreted as an array of chars starting i characters into the original string. ((str) + (i)) could be so interpreted. ((str) + (i)) is equivalent to &(str[i]) which is a very different thing from str[i]. -- s=%q( Daniel Martin -- martin@snowplow.org puts "s=%q(#{s})",s.map{|i|i}[1] ) puts "s=%q(#{s})",s.map{|i|i}[1]