BBC BASIC for Windows
« Resize Array »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Resize Array  (Read 501 times)
Kirkkaf13
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 28
xx Resize Array
« Thread started on: Apr 21st, 2015, 8:19pm »

Hello,

Is it possible to resize an array and keep the index values previously initialized?

I have attempted to redim an array and this can only be done on local and private arrays.

Thank you.

User IP Logged

rtr2
Guest
xx Re: Resize Array
« Reply #1 on: Apr 21st, 2015, 8:53pm »

on Apr 21st, 2015, 8:19pm, Kirkkaf13 wrote:
Is it possible to resize an array and keep the index values previously initialized?

There's a Wiki article on exactly that subject, I'm surprised you didn't find it yourself:

http://bb4w.wikispaces.com/Re-dimensioning+arrays

From your description what you probably need is the PROCredimpreserve1d() routine. There's an example of its use listed in the article:

Code:
      DIM array(100)
      FOR I% = 0 TO 100
        array(I%) = SQR(I%)
      NEXT
      PROCredimpreserve1d(array(), ^array(1)-^array(0), 200)
      FOR I% = 101 TO 200
        array(I%) = SQR(I%)
      NEXT
      FOR I% = 0 TO 200
        IF array(I%) <> SQR(I%) STOP
      NEXT
      PRINT "Test completed successfully"
      END 

Richard.
« Last Edit: Apr 21st, 2015, 8:58pm by rtr2 » User IP Logged

Kirkkaf13
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 28
xx Re: Resize Array
« Reply #2 on: Apr 21st, 2015, 9:01pm »

Richard,

I did not consider the wiki page, I did thoroughly check the manual. Unfortunately I have limited Internet access at the moment while I wait for my new ISP to go live, therefore resorting to my blackberry device for a connection.

Anyway I appreciate your speedy response, this looks to be what I was after.

Thank you.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls