Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Array copy problem
;******************************** total=3 array=ArrDimension(total) ArrInitialize(array,0) For counter=1 to total-1 array[counter]=counter Next ; Note the values in the array copy=array ; In the Winbatch Studio watchscreen: ; note that 2 arrays exist, both have the same values ; Now update only the 'copy' array For counter=0 to total-1 copy[counter]="test" Next ; Note the values in both arrays ; Values in 'array' also get updated Exit ;********************************So, when I update a value in the 'copy' array, the original array also gets updated. Is copying an array permitted and if so, is this a bug? Currently running Winbatch 2002K on a Windows 2000 machine.
copy=arrayMakes a duplicate of the pointer to the data. So now you have two variables pointing to the same chunk of data, not two seperate chunks of data.
See the udfArrCopy code in the following tech article: W15104
Article ID: W15444
File Created: 2003:05:13:11:27:54
Last Updated: 2003:05:13:11:27:54