#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct A
{
char a, b, c, d, e, f ;
};
#define DYNAMICALLY_SIZED 1
struct B
{
int sz ;
char name[DYNAMICALLY_SIZED] ;
};
struct B* make_b( const char* name )
{
struct B
* pb
= malloc( sizeof( struct B
) + strlen(name
) ) ; if(pb
) { pb
->sz
= strlen(name
) ; strcpy( pb
->name
, name
) ; } return pb ;
}
int main()
{
struct A a = { 'H', 'e', 'l', 'l', 'o', 0 } ;
struct B* ptr = make_b( &a ) ;
return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgoKc3RydWN0IEEKewogICAgY2hhciBhLCBiLCBjLCBkLCBlLCBmIDsKfTsKCiNkZWZpbmUgRFlOQU1JQ0FMTFlfU0laRUQgMQoKc3RydWN0IEIKewogICAgaW50IHN6IDsKICAgIGNoYXIgbmFtZVtEWU5BTUlDQUxMWV9TSVpFRF0gOwp9OwoKc3RydWN0IEIqIG1ha2VfYiggY29uc3QgY2hhciogbmFtZSApCnsKICAgIHN0cnVjdCBCKiBwYiA9IG1hbGxvYyggc2l6ZW9mKCBzdHJ1Y3QgQiApICsgc3RybGVuKG5hbWUpICkgOwogICAgaWYocGIpIHsgcGItPnN6ID0gc3RybGVuKG5hbWUpIDsgc3RyY3B5KCBwYi0+bmFtZSwgbmFtZSApIDsgfQogICAgcmV0dXJuIHBiIDsKfQoKaW50IG1haW4oKQp7CiAgICBzdHJ1Y3QgQSBhID0geyAnSCcsICdlJywgJ2wnLCAnbCcsICdvJywgMCB9IDsKICAgIHByaW50ZiggIiVzIFsldV1cbiIsICZhLCBzdHJsZW4oJmEpICkgOwoKICAgIHN0cnVjdCBCKiBwdHIgPSBtYWtlX2IoICZhICkgOwogICAgcHV0cyggcHRyLT5uYW1lICkgOwogICAgZnJlZShwdHIpIDsKICAgIAogICAgcmV0dXJuIDAgOwp9Cg==