yuumei
Joined: 15 Nov 2007 Posts: 1 Location: UK
|
Posted: Thu Nov 15, 2007 9:53 am Post subject: In out and ref |
|
|
Hey!
I just started with D and I love it!
Would anyone be able to tell me the difference between in, out, ref and inout.
Code: | import std.stdio;
void inTesting(in int a2, out int b2, ref int c2, int d2, inout int e2) {
writefln("%x, %x, %x, %x, %x", &a2, &b2, &c2, &d2, &e2);
}
int main() {
int a;
int b;
int c;
int d;
int e;
writefln("%x, %x, %x, %x, %x", &a, &b, &c, &d, &e);
inTesting(a, b, c, d, e);
return 0;
} |
I have tried this and it seems that 'in' makes a copy and 'out' is like a reference. But I cant figure out the rest. _________________ ^^* |
|