Re: populating a 2D array question



On Dec 9, 10:19 am, j...@xxxxxxxxxxx (Jens Thoms Toerring) wrote:
Zach <net...@xxxxxxxxx> wrote:
I'm populating a 2d array and wondering if it is valid to leave one
dimension with blank brackets while i assign a value to the other
dimension or must i fill them both in at once? Right now I was
thinking of doing:
zSet[i][ ] = lineZ[i+ (i-2)+11];
zSet[ ][i] = lineZ[i+ (i-1)+11];

No, you can't do that, you have to assign to each element
individually. All you can do is "populate" a complete row
in one go if you want to initialize it from a row of another
array of at least the same size and the same type by using
memcpy() but that's it. There isn't any implicit looping over
arrays of any dimensions in C.

Hi Jens,

Oh ok, thanks.

Zach
.



Relevant Pages

  • Language feature idea: "Compounded index property calculations". (For future parallel hardware layou
    ... I shall call the following programming language idea "Compounded index ... Second represents a conceptual "second dimension array". ... The actual calculation needs to be "deferred" until all three access, ...
    (alt.comp.lang.borland-delphi)
  • Re: Error on UBound with Dynamic Array
    ... ReDim Preserve arrSplit+ 1) ... is that arrSplit has not yet been dimmed as having any dimension. ... need to use a dynamic array and may be checking the boundries, ... Public Function Split(csvString As String) As Variant ...
    (microsoft.public.access.modulesdaovba)
  • Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
    ... subroutine and then call DCpZeros passing VxGrid, nRdim, and nTHdim. ... Then DCpZeros can dimension VxGrid (nRdim, ... (PS. I'm not concerned or worried about the array bounds exceeded! ...
    (comp.lang.fortran)
  • Re: Array Dim
    ... The "dimension" of an array is how many numbers there are in the comma separated list between the parentheses. ... When using the array in code, each of the numbers in the parentheses are called the Index for that dimension. ... I'm going to give you a made up example to show how to declare a Type object and then show you how to use it. ... The Type Statement starts with the Type keyword and it is followed by the name you want to give to the structure that follows below it (here, I have chosen to call it EmployeeRecords) and ends with the End Type statement. ...
    (microsoft.public.excel.programming)
  • Re: Playing with multidimensional array!?
    ... In traditional compiler languages, rows and columns are differentiated by ... the fact that a two dimensional array occupies contiguous storage locations. ... fact that redim can affect only the last dimension. ... consider these the first dimension and the second dimension rather than row ...
    (microsoft.public.scripting.vbscript)