the convention for declaring arrays in pseudocode

Problem Detail: I have a very simple question. What is the right standard convention to use for declaring arrays? I understand that for a simple declaration of a variable as an integer, this is the convention:

DECLARE myVar : INTEGER 

What about for an integer array of 10 elements?

DECLARE myVar : ARRAY[1,10] of INT 

or

DECLARE myVar[1,10] : ARRAY of INT 

or something else?

Asked By : user961627

Answered By : David Richerby

Pseudocode is not a formal language. Declare your arrays however you want, as long as it’s obvious what you mean. Including the full limits (as you have in both your array examples) is good, since it means the reader isn’t worrying about whether you start your indices at 0 or 1.
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/42226

Leave a Reply