Site icon TestingDocs.com

Setup Array in Flowgorithm

Overview

In this tutorial, we will learn basic steps to set up an array in Flowgorithm. This is a detailed step-by-step guide intended for beginners.

Array Definition

An array is a collection of items( elements ) of the same data type stored using a single variable name in continuous memory locations. Flowgorithm only supports one-dimensional array.

Declare an array

This step defines the array in the flowchart. We use the Declare flowchart symbol. This symbol will create the array variable.

The number of elements the array can hold is static. The programmer has to specify the size during the array creation process.

Storing Elements in an Array

Now that we have defined the array, we can start using it. The initial part is to store the elements in the array so that we can process them afterward.

Using the Assign statement, we can store an element with the array variable name and subscript.

In the Flowgorithm, the subscript number starts from 0. For an array of size n, the valid values of the subscript are from 0 to n-1. The array subscript cannot be outside this valid range. For example, if the array size is 10, we can use the valid range of the subscript from 0 to (10-1), i.e., 0 to 9.

A good subscript is a value that is within the valid range. For example, a good subscript for the above example is 0 to 9, both inclusive. A bad subscript is a value that falls outside this valid range.

The subscript is enclosed with square brackets. For example, we can use the index as 0 to store the first element.

arr[0] = 5

Access an Array element

When we store the array variable, it is on the left hand. The array element is on the right-hand side.

We use the array variable with a subscript on the right-hand side to access an array element. We can process or store the array element in another variable.

second_element = arr[1]

 

Flowgorithm Tutorials

Flowgorithm flowchart tutorials on this website:

https://www.testingdocs.com/flowgorithm-flowchart-tutorial/

Flowgorithm Website

For more information on the Flowgorithm tool, please visit the official website at:

http://flowgorithm.org/

 

Exit mobile version