Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
copy a 2d array to another Posted by Malekovits on 24 Nov 2010 at 3:03 PM
Hi! I know that there are some ways for copying (2d)arrays in pascal (I use borland pascal). One is to use for-loops and the other one is to use something like array1:=array2. That's what i know so far. Of course i know that there is the fillchar that fills an array with a specified character. I wonder how to do this without for-loops:

copy an array into another but only some elements. To be more specific, the array i want to copy is char type, and it has empty elements(even if you don't put something, the space itself is a character.)that i dont want to be copied to the other array. Until now I did this with for-loops:

for i:=1 to 10 do
for j:=1 to 10 do
if array1[i,j] <> ' ' do array2[i,j]:=array1[i,j];

Is there any way that i can do the same thing without for loops? With for loops its very very slow, but when use something like array1:=array2
its blazingly faster, but then you copy everything that array2 has, and I want NOT to copy the "empty" or " " characters (or any one else character that might be specified). Hope you understand what I am saying...
Thread Tree
Malekovits copy a 2d array to another on 24 Nov 2010 at 3:03 PM
_Atex_ Re: copy a 2d array to another on 25 Nov 2010 at 12:02 AM
Malekovits Re: copy a 2d array to another on 25 Nov 2010 at 4:07 AM
_Atex_ Re: copy a 2d array to another on 25 Nov 2010 at 10:08 PM
Malekovits Re: copy a 2d array to another on 26 Nov 2010 at 3:25 PM
_Atex_ Re: copy a 2d array to another on 26 Nov 2010 at 6:43 PM
Malekovits Re: copy a 2d array to another on 27 Nov 2010 at 3:25 AM
_Atex_ Re: copy a 2d array to another on 27 Nov 2010 at 5:25 PM
Malekovits Re: copy a 2d array to another on 28 Nov 2010 at 5:03 AM
_Atex_ Re: copy a 2d array to another on 28 Nov 2010 at 3:11 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.