Hacker News new | past | comments | ask | show | jobs | submit login

> In C/C++, the dimensions of an array must be declared at the beginning of a function)". First, no opening "(". What kind of Lisp hacker does this? Second, both in C and in C++ functions can (of course) take variable-sized arrays. (And, there is no such language as "C/C++").

In c, an array has fixed size and dimensionality. You can, of course, create your own data structure using a pointer which allows you to access an unbounded number of objects; but that, in c parlance, is not an array.

And in c89, all variables must be declared at the beginning of a lexical scope (though not necessarily the beginning of a function).




C supports variable-length arrays since C99[1][2]. Alas, Lisp Machines preceded C99.

[1]: https://en.wikipedia.org/wiki/Variable-length_array#C99

[2]: https://en.cppreference.com/w/c/language/array


Yes, but they're optional as of c11.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: