sk7799
1
Hi,
For example for an array given below, how can the elements be reversed without using the reverse() function.
int array [10] = {15, 3, 12, 8, 8, 6, 8, 3, 4, 10};
I am thinking I can get the size/2 and start swapping the first and last and so on by decrementing each index.
Thanks in adavnce.
In reply to sk7799:
I assume you can use another helper array i.e
int array_help[ 10 ] ;
initial begin
array_help = array ;
foreach( array[i] )
array[i] = array_help[ ( array_help.size() - 1 ) - i ] ;
end
VE1
3
In reply to sk7799:
or
result_array = { << 32{array]};