1
para i de 1 ate array.length faca
escreval("Falta ", i, "?")
leia(falta[i])
i <- (i + 1)
fimpara
For example, in Java it is array.length
.
1
para i de 1 ate array.length faca
escreval("Falta ", i, "?")
leia(falta[i])
i <- (i + 1)
fimpara
For example, in Java it is array.length
.
1
As far as I know has not, because in Visualg the array always has fixed size and previously defined in the declaration of variables, so the size is always known by your code, there has to be a mechanism that says this.
It is true that this creates addiction, but for exercise it is good. Just understand that this is not how you do it in real code, just as you do not declare variable before you use it, this is a limitation of the language you are using.
You can use a constant or even variable with the size, and then use in the declaration and where you need this information, so avoid the magic numbers. It’s good practice, but for exercise it matters little, it helps not to get an addiction, but you’ll be getting others anyway.
If you want to have something without knowing the size previously then do it in Java and almost any other language that allows it.
Browser other questions tagged array variable-declaration visualg
You are not signed in. Login or sign up in order to post.
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero