ns2 global variable

1.2k Views Asked by At

I have created variable using loop like that:

   for {set i 0} {$i<5} {incr i} {
        set n($i) [$ns node]
   }

How to call n($i) variable by some procedure? I call it as

global n(0) n(1) n(2) n(3) n(4)

But I got the error :

ns: record: bad variable name "n(0)": upvar won't create a scalar variable that looks like an array element while executing

1

There are 1 best solutions below

0
On

I figured out : global n is enough to call array variable n.