"Bill Cunningham" <> writes:
> Many thanks to Santosh with that link to a simpler descibed k&r2. I'm
> learning slowly.
>
> But here's the question:
>
> int [3][7];
>
> A two dimensional array says three something are arrays of type int each
> containing arrays of 7 elements. What about the first dimension [3]? Is it
> type int too?
In C, a two dimensional array is exactly the same thing as an array of
arrays. If you understand C arrays (which is no small feat in
itself), then everything about multidimensional arrays follows from
that.
The above declaration doesn't actually declare anything. I think what
you meant was:
int array_object[3][7];
array_object itself is of type "array 3 of array 7 of int". It's an
array consisting of 3 elements; each element is of type "array 7 of
int". Each element of each element of array_object is of type int.
(The indices can be of any integer type. The index type isn't part of
an array type; only the length of each dimension is.)
If you haven't already done so, take a look at the comp.lang.c FAQ,
<http://www.c-faq.com/>, particularly section 6.
--
Keith Thompson (The_Other_Keith) <kst->
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
|