TCL 传引用调用

来源:互联网 发布:mac制作铃声 编辑:程序博客网 时间:2024/05/19 14:51

普通变量参数

proc SetVal {data} {    upvar $data d    set d 1}set data 0SetVal dataputs "after SetVal"puts "data = $data"


数组参数

proc SetVal {ptr} {    upvar ptr a    set a(0) "this is the 1st element"    set a(1) "this is the 2nd element"}SetVal ptrputs "after SetVal"puts $ptr(0)puts $ptr(1)



 

0 0
原创粉丝点击