How to get array length

kaz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 24 23:49:35 PDT 2014


On Thursday, 22 May 2014 at 23:24:30 UTC, Brad Anderson wrote:
> On Thursday, 22 May 2014 at 23:22:44 UTC, kaz wrote:
>> Is there a way to get the length of an array out of slice 
>> bracket in D?
>>
>> Tks.
>
> Just use .length:
>
> void main()
> {
> 	import std.stdio;
> 	auto a = new int[5];
> 	auto b = a[];
> 	writeln(a.length, " ", b.length);	
> }

Tks.


More information about the Digitalmars-d-learn mailing list