Jaken
Jaken

Reputation: 1343

Zero out Ada 2D array of given size

I have M : array (1..3, 1.. 3) of Integer := ((0, 0, 0), (0, 0, 0), (0, 0, 0));

I am looking to convert the size of this to be user-determined, i.e., the new array would look something like M : array (1 .. user_size, 1 .. user_size) of ...

The problem I'm having is the case of zero-ing out the array. I'm not extremely familiar with Ada, but learning.

Is there a way to do this?

Upvotes: 1

Views: 418

Answers (1)

egilhh
egilhh

Reputation: 6430

try

(others => (others => 0));

Upvotes: 7

Related Questions