Why can't I do this?

M. J. Shannon, Jr. mjs at rabbit.UUCP
Sat Jan 14 00:42:14 AEST 1984


WHat you probably want to say is:
	static int int_array[][] =
	{
		{ 0, 1, 2, 3, /* padded to longest */ },
		{ 17, 42 },
		{ 11, 15, 57 },
	};

What is meant by what you said is: initialize an array of pointers.
You can't initialize a pointer with an aggregate.  The reason it works
for strings is that the type of "foo" is `char *'.  There is no way of
using the same sort of syntax to do the same for int arrays.
-- 
	Marty Shannon
UUCP:	{alice,rabbit,research}!mjs
Phone:	201-582-3199



More information about the Comp.lang.c mailing list