Sujet : Re: Two questions on arrays with size defined by variables
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 09. Feb 2025, 18:19:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <voao29$o6uh$2@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 09.02.2025 15:29, Waldek Hebisch wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>
And in "C" (C99) I tried it *without* the _inner block_
>
main ()
{
int n = 5;
char * arr[n];
...
}
>
and it seemed to work that way. (In those other languages that wasn't
possible.)
Hmm, IIRC both (Extended) Pascal and PL/I allow VLA within function
in places where they allow variable declarations, so really no
special _inner block_ requirement (just must be local to a function).
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.)