How to pass static array to function not by value?
    Eric via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Nov 22 08:05:04 PST 2014
    
    
  
On Saturday, 22 November 2014 at 15:57:40 UTC, ketmar via 
Digitalmars-d-learn wrote:
> On Sat, 22 Nov 2014 15:45:51 +0000
> Eric via Digitalmars-d-learn 
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> Maybe this is not so lame because change() can take
>> any length of static array.
>
>   void change (int[] arr) {
>     arr[1] = 42;
>   }
>
>   void main () {
>     int[$] a = [1, 2, 3];
>     change(a);
>     import std.stdio : writeln;
>     writeln(a); // [1, 42, 3]
>   }
Okay, the pointer way really is lame then:)
-Eric
    
    
More information about the Digitalmars-d-learn
mailing list