References

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Nov 27 23:14:45 PST 2011


Use ref:

void f1(ref int val)
{
    val = 1;
}

Another one is 'out', which initializes the type with it's .init value
on function entry:

void foo(out int val) {}

This is (I believe) equivalent to the following:

void foo(ref int val)
{
    val = int.init;
    // your code here..
}


More information about the Digitalmars-d-learn mailing list