When I searched around, looking to learn how to do a REAL multi-dimensional array, because I needed one as a constant, I can't seem to find anywhere
Well you might have searched with improper vocabulary. This is known as aggregate initialization and list initialization
So A couple things you could add
- the compiler can do size calculation for you if you populate the arrays
int vector[] = {1,2,3,4};// compiler will decide you need 4 elements
Only the "left-most" dimension can have its size left out
int matrix[][3] = {{1,2,3},{4,5,6},{7,8,9}};
This is because the compiler really sees this as a pointer to the start of the data, and so you need to help the compiler understand where the next row starts to perform maths on pointers in memory. the compiler will recursively initialize the array, noting that each subarray starts with a left brace and has no more than the required number of initializers, and will count the number of subarrays to determine the first dimension of the array.
This is described in “The C Programming Language" by K&R
An aggregate is a structure or array. If an aggregate contains members of aggregate type, the initialization rules apply recursively. Braces may be elided in the initialization as follows: if the initializer for an aggregate's member that is itself an aggregate begins with a left brace, then the succeeding comma-separated list of initializers initialize the members of the sub aggregate; it is erroneous for there to be more initializers than members. If, however, the initializer for a subaggregate does not begin with a left brace, then only enough elements from the list are taken to account of the members of the subaggregate; any remaining members are left to initialize the next member of the aggregate of which the subaggregate is a part. For example,
int x[] = { 1, 3, 5 };
declares and initializes x as a 1-dimensional array with thee members, since no size was specified and there are three initializers.
- such assignments can be done only when you declare and define the variable, not later in code