C style array declaration.
Adam D. Ruppe
destructionator at gmail.com
Mon Mar 26 12:46:46 UTC 2018
On Monday, 26 March 2018 at 10:16:55 UTC, Aedt wrote:
> I'm a big fan of betterC. In C, you can initialize an array
> without specifying the length like this
> int ia[ ] = {0, 2, 1};
That's the equivalent of D's static arrays if a variable, and is
passed to C functions as a pointer. So important to note it is
two different beasts in different contexts.
I recently wrote about this here:
https://forum.dlang.org/thread/uhibzcfwzqzqqfbrckup@forum.dlang.org
so read that post for some more detail, especially with relation
to `extern` variables.
> Also, is it possible to retrieve the pointer of the sequence of
> actual data from std.container.array? If all fails I'd like to
> use this container.
address of first element for that, but if you are using a
built-in D array, you can also just `arr.ptr`.
More information about the Digitalmars-d-learn
mailing list