initializing an array

Sun Visualization Products matthew at sunpix.UUCP
Tue May 9 07:02:15 AEST 1989


In article <12814 at ut-emx.UUCP>, reeder at ut-emx.UUCP (William P. Reeder) writes:
| I can initialize a simple array like this:
| 	int a[] = { 1, 2, 3 };
| and C will figure out that a must have 3 elements.  But what if
| my array has two dimensions?
| 	int a[][] = {
| 		{ 1, 2, 3 },
| 		{ 4, 5, 6 },
| 		{ 7, 8, 9 },  <------ remove this excess ','
| 	};
| 
| It is possible to determine from the syntax how many elements there
| are in each dimension, but my compiler complains about a null
| dimension.
| 

Of course it going to complain about a null dimension.  You've got an extra ','
in the initializer declaration.


-- 
Matthew Lee Stier                         |
Sun Microsystems ---  RTP, NC  27709-3447 |        "Wisconsin   Escapee"
uucp: { sun, mcnc!rti }!sunpix!matthew    |
phone: (919) 469-8300 fax: (919) 460-8355 |



More information about the Comp.lang.c mailing list