#include <stdio.h>
#include <stdlib.h>
int* uniao(int *v1, int n1, int *v2, int n2) {
int *v3
= malloc((n1
+ n2
) * sizeof(int)); for (int i = 0; i < n1; i++) v3[i] = v1[i];
for (int i = n1, j = 0; j < n2; i++, j++) v3[i] = v2[j];
return v3;
}
int main(void) {
int v1[] = { 1, 2, 3 };
int v2[] = { 4, 5, 6 };
int *pAux = uniao(v1, 3, v2, 3);
for (int i = 0; i < 6; i++) {
}
}
//https://pt.stackoverflow.com/q/251687/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCogdW5pYW8oaW50ICp2MSwgaW50IG4xLCBpbnQgKnYyLCBpbnQgbjIpIHsKCWludCAqdjMgPSBtYWxsb2MoKG4xICsgbjIpICogc2l6ZW9mKGludCkpOwoJZm9yIChpbnQgaSA9IDA7IGkgPCBuMTsgaSsrKSB2M1tpXSA9IHYxW2ldOwoJZm9yIChpbnQgaSA9IG4xLCBqID0gMDsgaiA8IG4yOyBpKyssIGorKykgdjNbaV0gPSB2MltqXTsKCXJldHVybiB2MzsKfQoKaW50IG1haW4odm9pZCkgewoJaW50IHYxW10gPSB7IDEsIDIsIDMgfTsKCWludCB2MltdID0geyA0LCA1LCA2IH07CglpbnQgKnBBdXggPSB1bmlhbyh2MSwgMywgdjIsIDMpOwoJZm9yIChpbnQgaSA9IDA7IGkgPCA2OyBpKyspIHsKCSAgICBwcmludGYoIiVkXG4iLCBwQXV4W2ldKTsKCX0KfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMjUxNjg3LzEwMQ==