Re: Arrays
- From: "Bob" <someonw@xxxxxx>
- Date: Tue, 26 Aug 2008 09:38:20 -0700
Thanks Ralph. I guess, I will use loops. By the way, in VB is there any
way of using pointers for arrays, like C or Fortran. If so, then I can pass
the pointer.
Bob
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:OkqjLlxBJHA.4932@xxxxxxxxxxxxxxxxxxxxxxx
"Bob" <someonw@xxxxxx> wrote in message
news:uL$94mwBJHA.2292@xxxxxxxxxxxxxxxxxxxxxxx
Hi everyone:want
1- I have two arrays Arr1 and Arr2 of sizes 100 and 25 respectively. I
to send the last 25 elements of Arr1 into Arr2, for example elements 76
to
100. Is there any way of doing this without loops, like for example;
Arr2=Arr1(76)
2- What is I want to pass the last 25 elements of Arr1 to another routine
sub first(Arr2)
.
.
end sub
call first(Arr1(76))
is this possible?
Thanks for all your help.
Bob
Depends what the array is an array of.
If you have Byte Arrays then you could simply do this...
Dim Arr2() As Byte
Arr2 = MidB(Arr1, 76, 100)
[The Array must start with meaningful data at '1', because that is where
Mid
starts.]
You could use the CopyMemory API in some cases, but note it is only a
shallow copy. It would produce only a 'clone' if for example if you had an
Array of Objects.
In general while a loop may look like extra processing, with compiler
optimization it is likely not that noticably slower for arrays with sizes
within reason - and in fact is doing nothing more than what the CopyMemory
routine would be doing. While providing an opportunity to perform deep
copies for complex objects.
Warning Air Code!
Dim Arr2() As MyCreature
ReDim Arr2(25)
For k = 0 To 24
Arr2(k) = Arr1(k + 75)
Next
.
- Follow-Ups:
- Re: Arrays
- From: Jeff Johnson
- Re: Arrays
- References:
- Arrays
- From: Bob
- Re: Arrays
- From: Ralph
- Arrays
- Prev by Date: Re: Arrays
- Next by Date: Re: Arrays
- Previous by thread: Re: Arrays
- Next by thread: Re: Arrays
- Index(es):
Relevant Pages
|
Loading