Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdahl!pacbell!ditka!rpp386!jfh From: jfh@rpp386.Dallas.TX.US (The Beach Bum) Newsgroups: comp.lang.c Subject: Re: What does Z["ack"] = 5 mean? Message-ID: <7607@rpp386.Dallas.TX.US> Date: 6 Oct 88 04:27:31 GMT References: <14999@agate.BERKELEY.EDU> Reply-To: jfh@rpp386.Dallas.TX.US (The Beach Bum) Organization: River Parishes Programming, Dallas TX Lines: 38 In article <14999@agate.BERKELEY.EDU> laba-3aw@web.berkeley.edu (Sam Shen) writes: >Exactly what does this mean: > >main() >{ > char Z; > > Z["ack!"] = 5; >} The same as char Z; "ack!"[Z] = 5; >This doesn't look right to me. However, cc doesn't complain >at all about it. Lint says: > >blah.c(5): warning: Z may be used before set Right. It should be char Z = 0; to give Z a reasonable value. That would produce code to change the 'a' in "ack!" to a \005, which is ^E. >Worse yet, the executable produced by gcc core dumps. Oh, by the way, this >is all on a Sun-3/50. And well it should. -- John F. Haugh II (jfh@rpp386.Dallas.TX.US) HASA, "S" Division "Why waste negative entropy on comments, when you could use the same entropy to create bugs instead?" -- Steve Elias