Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
One way to copy whole contents of an array into another array Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
18-Jun-03
Category
OO-related
Language
Delphi 3.x
Views
151
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Christer Johansson

You have an array and you want to copy the value you have in it to another array.

Answer:

I just use a button to se if it compile and if I get an Error when I click it. 
There ar other ways, like copy an array in a for loop, but then you have to know 
how big it is. If you handle different arrays in an application and need to copy 
them into one, this is the way. As you can se, it works with just one index of the 
array too. 

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7     StdCtrls;
8   
9   type
10    TForm1 = class(TForm)
11      Label1: TLabel;
12      Button1: TButton;
13      procedure Button1Click(Sender: TObject);
14    private
15      Array1: array[0..40] of Integer;
16      Array2: array[0..100] of Integer;
17    public
18      { Public declarations }
19    end;
20  
21  var
22    Form1: TForm1;
23  
24  implementation
25  
26  {$R *.DFM}
27  
28  procedure TForm1.Button1Click(Sender: TObject);
29  begin
30    Move(Array1, Array2, SizeOf(Array1)); {Moves/Copy the Array1 to Array2.}
31  end;
32  
33  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC