Skip to content

Instantly share code, notes, and snippets.



Created May 14, 2011
What would you like to do?
PyObject の基礎: ソースコード2
#include <stdio.h>
#include <stdlib.h>
struct base {
int basic_field;
struct extended {
struct base base;
int extended_field;
int main(void)
struct base *base_obj;
struct extended *obj = malloc(sizeof(struct extended));
obj->base.basic_field = 1;
obj->extended_field = 2;
base_obj = (struct base *) obj;
printf("base_obj->basic_field: %d\n", base_obj->basic_field);
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment