.sizeof dynamically allocated array

Adel Mamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 11 13:09:37 PDT 2015


import std.stdio;

void main()
{
     ubyte[] a1 = new ubyte[65];
     ubyte[65] a2;

     writeln("a1.sizeof = ", a1.sizeof); // prints 16
     writeln("a2.sizeof = ", a2.sizeof); // prints 65
}

Why a1.sizeof is 16?


More information about the Digitalmars-d-learn mailing list