How to pass static array to function not by value?
    ketmar via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Nov 22 07:57:30 PST 2014
    
    
  
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]
  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141122/49b11e97/attachment.sig>
    
    
More information about the Digitalmars-d-learn
mailing list