patternMinor
the convention for declaring arrays in pseudocode
Viewed 0 times
thearraysconventionpseudocodedeclaringfor
Problem
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:
What about for an integer array of 10 elements?
or
or something else?
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 : INTEGERWhat about for an integer array of 10 elements?
DECLARE myVar : ARRAY[1,10] of INTor
DECLARE myVar[1,10] : ARRAY of INTor something else?
Solution
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.
Context
StackExchange Computer Science Q#42226, answer score: 9
Revisions (0)
No revisions yet.