passing string array to a function
Hi
I am trying to pass the string array to a function print_it(). I get the following error:
Error: Reference out of bound array word
Trying to take a reference to an array word with an out of bounds index
I think I am making some basic mistake in passing string array to the function. Can anyone please help me out???
Sorry, the code is written in system verilog but it is similar to C++....
The code is shown below:
Code:
class A;
string mode1[3] = '{"chip", "boundary", "chain"};
string mode2[2] = '{"chip", "chain"};
endclass : A
class B;
function void print_it(string details[]);
A test_mode;
test_mode = new();
foreach(details[i])
begin
test_mode.mode1=xxx
$display(details[i]);
end
endfunction: print_it
endclass : B
class C;
A test_mode;
B printing;
printing.print_it(test_mode.mode1);
endclass:C