[ create a new paste ] login | about

Link: http://codepad.org/gDXlvhWx    [ raw code | output | fork ]

D, pasted on May 21:
import std.stdio;

struct Foo {
	int a = 0;
	int b = 0;
}

void main() {
	Foo a;
	Foo *b = new Foo();

	a.a = 1;
	a.b = 2;

	b.a = 3;
	b.b = 4;

	writefln("a: {%s, %s}", a.a, a.b);
	writefln("b(.): {%s, %s}", b.a, b.b);
	writefln("b(->): {%s, %s}", (*b).a, (*b).b);
	writefln("&a: %s", &a);
	writefln("&b: %s", &b);
	writefln("b: %s", b);


	delete b;
}


Output:
1
2
3
4
5
6
a: {1, 2}
b(.): {3, 4}
b(->): {3, 4}
&a: BFB07534
&b: BFB0753C
b: 401C3FC0


Create a new paste based on this one


Comments: