#include <stdio.h>
#include <string.h>
#include <stdarg.h>
void initarray(int*d,int n,...)
{
va_list v;
for(int i
=0;n
--;) d
[i
++]=va_arg(v
,int); }
int main()
{
int v[3]; /* Zielarray */
typedef struct{int i[3];} I3; /* Hilfstyp für struct-Kopie */
{ int x[3]={1,2,3}; *(I3*)v=*(I3*)x; }
printf("%d%d%d\n",*v
,v
[1],v
[2]);
{ int x
[3]={4,5,6}; memcpy(v
,x
,sizeof v
); } printf("%d%d%d\n",*v
,v
[1],v
[2]);
*(I3*)v=*(I3*)(int[3]){7,8,9};
printf("%d%d%d\n",*v
,v
[1],v
[2]);
memcpy(v
,(int[3]){4,4,4},sizeof v
); printf("%d%d%d\n",*v
,v
[1],v
[2]);
initarray(v,3,9,9,9);
printf("%d%d%d\n",*v
,v
[1],v
[2]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPHN0ZGFyZy5oPgoKdm9pZCBpbml0YXJyYXkoaW50KmQsaW50IG4sLi4uKQp7Cgl2YV9saXN0IHY7Cgl2YV9zdGFydCh2LG4pOwoJZm9yKGludCBpPTA7bi0tOykgZFtpKytdPXZhX2FyZyh2LGludCk7Cgl2YV9lbmQodik7Cn0KCmludCBtYWluKCkKewoJaW50IHZbM107ICAvKiBaaWVsYXJyYXkgKi8KCXR5cGVkZWYgc3RydWN0e2ludCBpWzNdO30gSTM7IC8qIEhpbGZzdHlwIGbDvHIgc3RydWN0LUtvcGllICovCgkKCXsgaW50IHhbM109ezEsMiwzfTsJKihJMyopdj0qKEkzKil4OyB9CglwcmludGYoIiVkJWQlZFxuIiwqdix2WzFdLHZbMl0pOwoJCgl7IGludCB4WzNdPXs0LDUsNn07CW1lbWNweSh2LHgsc2l6ZW9mIHYpOyB9CglwcmludGYoIiVkJWQlZFxuIiwqdix2WzFdLHZbMl0pOwoKCSooSTMqKXY9KihJMyopKGludFszXSl7Nyw4LDl9OwoJcHJpbnRmKCIlZCVkJWRcbiIsKnYsdlsxXSx2WzJdKTsKCQoJbWVtY3B5KHYsKGludFszXSl7NCw0LDR9LHNpemVvZiB2KTsKCXByaW50ZigiJWQlZCVkXG4iLCp2LHZbMV0sdlsyXSk7CgkKCWluaXRhcnJheSh2LDMsOSw5LDkpOwoJcHJpbnRmKCIlZCVkJWRcbiIsKnYsdlsxXSx2WzJdKTsKCglyZXR1cm4gMDsKfQo=