Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
copy a 2d array to another
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...
0 · ·