fork download
#include <stdio.h>
#include <stdlib.h>

struct base
{
	double some;
};

struct derived
{
	double some;
	int value;
};

int main(void) {
	struct base *b = malloc(sizeof(struct derived));
	b->some = 123.456;
	struct derived *d = (struct derived*)(b);
	d->value = 4;
	struct base *bb = (struct base*)(d);
	printf("%f\t%f\t%d\n", d->some, bb->some, d->value);
	return 0;
}
Success #stdin #stdout 0s 10304KB
stdin
Standard input is empty
stdout
123.456000	123.456000	4