How to resolve the algorithm Arrays step by step in the OxygenBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Arrays step by step in the OxygenBasic programming language

Table of Contents

Problem Statement

This task is about arrays. For hashes or associative arrays, please see Creating an Associative Array. For a definition and in-depth discussion of what an array is, see Array.

Show basic array syntax in your language. Basically, create an array, assign a value to it, and retrieve an element   (if available, show both fixed-length arrays and dynamic arrays, pushing a value into it). Please discuss at Village Pump:   Arrays.
Please merge code in from these obsolete tasks:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Arrays step by step in the OxygenBasic programming language

Source code in the oxygenbasic programming language

'CREATING A STATIC ARRAY
float fs[100]

'SETTING INDEX BASE
indexbase 1 'default

'FILLING PART OF AN ARRAY
fs[20]={2,4,6,8,10,12}

'MAPPING AN ARRAY TO ANOTHER
float *g
@g=@fs[20]
print g[6] 'result 12

'DYNAMIC (RESIZEABLE) ARRAYS
redim float fd(100)
fd={2,4,6,8}               'assign some values
redim float fd(200)        'expand array
print fd(2)                'original values are preserved by default
redim float fd(200) clear  'array elements are cleared 
print fd(2)                'value set to 0.0
redim float fd(0)          'release allocated memory          '

  

You may also check:How to resolve the algorithm Find the intersection of a line with a plane step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm Word frequency step by step in the Frink programming language
You may also check:How to resolve the algorithm N-queens problem step by step in the Seed7 programming language
You may also check:How to resolve the algorithm Call a foreign-language function step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm Array length step by step in the Mercury programming language