Sujet : Re: Two questions on arrays with size defined by variables
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 10. Feb 2025, 00:50:26
Autres entêtes
Organisation : None to speak of
Message-ID : <87bjvar83h.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5
User-Agent : Gnus/5.13 (Gnus v5.13)
Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> writes:
[...]
I had other languages in mind.[*]
>
Janis
>
[*] For example Simula:
>
begin
integer n;
n := inint;
begin
integer array arr (1:n);
arr(5) := 9;
end
end
>
(Which is also understandable, since in Simula declarations must appear
before statements in any block.)
Apparently Simula doesn't allow variables to be initialized in their
declarations. Because of that, `n := inint;` (where inint is actually a
call to a value-returning procedure) is a separate statement. If
Simula supported C-style initializers, then presumably the inner block
would not be needed:
begin
integer n := inint;
integer array arr (1:n);
arr(5) := 9;
end
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */