Skip to content

Instantly share code, notes, and snippets.

@tana
Created July 29, 2010 07:28
Show Gist options
  • Save tana/497503 to your computer and use it in GitHub Desktop.
Save tana/497503 to your computer and use it in GitHub Desktop.
#include <stdio.h>
struct Hoge {
int num;
};
struct Aaaaa {
struct Hoge hoge;
int n;
};
int main() {
struct Hoge h;
h.num = 10;
struct Aaaaa a;
a.hoge = h;
struct Aaaaa* ap = &a;
struct Hoge* hop = (struct Hoge*)ap;
printf("num=%d\n", hop->num);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment