What does Z["ack"] = 5 mean?

Sam Shen laba-3aw at web.berkeley.edu
Wed Oct 5 13:05:25 AEST 1988


Exactly what does this mean:

main()
{
	char Z;

	Z["ack!"] = 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

And finally GNU C, (gcc -Wall) says:

blah.c:2: warning: return-type defaults to `int'
blah.c:6: warning: control reaches end of non-void function

Worse yet, the executable produced by gcc core dumps.  Oh, by the way, this
is all on a Sun-3/50.

Sam Shen (laba-3aw at web.berkeley.edu)



More information about the Comp.lang.c mailing list