#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct __attribute__((__packed__)) weird_struct
{
int some;
unsigned char value[1];
};
int main(void)
{
unsigned char text[] = "Allie has a cat";
struct weird_struct *ws =
malloc(sizeof(struct weird_struct
) + sizeof(text
) - 1); ws->some = 5;
printf("some = %d, value = %s\n", ws
->some
, ws
->value
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKc3RydWN0IF9fYXR0cmlidXRlX18oKF9fcGFja2VkX18pKSB3ZWlyZF9zdHJ1Y3QKewoJaW50IHNvbWU7Cgl1bnNpZ25lZCBjaGFyIHZhbHVlWzFdOwp9OwoKaW50IG1haW4odm9pZCkKewoJdW5zaWduZWQgY2hhciB0ZXh0W10gPSAiQWxsaWUgaGFzIGEgY2F0IjsKCXN0cnVjdCB3ZWlyZF9zdHJ1Y3QgKndzID0KCQltYWxsb2Moc2l6ZW9mKHN0cnVjdCB3ZWlyZF9zdHJ1Y3QpICsgc2l6ZW9mKHRleHQpIC0gMSk7Cgl3cy0+c29tZSA9IDU7CglzdHJjcHkod3MtPnZhbHVlLCB0ZXh0KTsKCXByaW50Zigic29tZSA9ICVkLCB2YWx1ZSA9ICVzXG4iLCB3cy0+c29tZSwgd3MtPnZhbHVlKTsKCWZyZWUod3MpOwoJcmV0dXJuIDA7Cn0K