Is it possible to pass a vector as a parameter in Visualg?

Asked

Viewed 679 times

1

Is it possible to pass a vector as a parameter in Visualg? If yes, which methods should be used?

2 answers

1


It is not possible to pass a vector as a parameter to a function since the vector is a structured data and not a valid data type.

According to the visualG 3.0 manual valid data types are only:

  • Whole
  • Royal
  • Logical
  • Character

When trying to declare a function with the vector structure, the program returns the message of data type "VECTOR" not recognised, because in fact, par to visualG is not a type of data. As well as trying to perform the flame of a vector, passing the structure as argument, an error of "hoped to find a [".

If the function does not change the original vector size, you can use a global temporary vector and manipulate by the function, but you cannot pass it by parameter.

0

To declare a vector in Visualg use vet: vetor [1..10] de real. Then iterate with it use vet[1], for example.

Note that the total number of variables supported by Visualg is 500 and each element of an array is counted individually. That is, if you declare 4 variables of type int can only have a vector with 495 positions, at most.

Here you check the manual of Visualg or here for an indexed version.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.