Assigning entire row in a 2d array?

T

Tricky

Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?
 
H

h.e.

Tricky said:
Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?

have you tried A := (others=>(others=>0)); ?
 
T

Tricky

Tricky schrieb:











have you tried A := (others=>(others=>0)); ?

That wont work, you'd have to do A := (others =>0) and that would
assign the entire 2d array.

I just want to assign a single row to 0, not every element.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top