Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int* uniao(int *x1, int *x2, int n1, int n2, int *qtd)
- {
- int tam=(n1+n2);
- int i=0, j=0;
- qtd=(int*)malloc(tam*sizeof(int));
- for(i=0; i<n1; i++)
- {
- *(qtd+i)=*(x1+i);
- }
- for(i=n1; i<tam; i++,j++)
- {
- *(qtd+i)=*(x2+j);
- }
- return(qtd);
- }
- int main()
- {
- int x1[]={1,3,5,6,7}, x2[]={1,3,4,6,8}, n1=5, n2=5, *x3=0, *qtd=0;
- int i;
- x3=uniao(x1,x2,n1,n2,&qtd);
- for(i=0; i<10; i++)
- {
- printf("%d\t", *(x3+i));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement