Skip to content

Instantly share code, notes, and snippets.

@mhx
Created August 30, 2012 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhx/3532140 to your computer and use it in GitHub Desktop.
Save mhx/3532140 to your computer and use it in GitHub Desktop.
marcus@balrog ~ $ cat test.cpp
#include <iostream>
struct Versuch {
int foo1;
int foo2;
int foo3;
int foo4;
};
int main()
{
Versuch *v = new Versuch;
v->foo1 = 1;
v->foo2 = 2;
v->foo3 = 3;
v->foo4 = 4;
int *p = &v->foo1;
for (size_t i = 0; i < 4; ++i)
std::cout << p[i] << std::endl;
return 0;
}
marcus@balrog ~ $ g++ -o test test.cpp
marcus@balrog ~ $ ./test
1
2
3
4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment