I have to make a union of two arrays and each of them has <=20 elements. So I was thinking to form the third array which will contain the elements for a union. Some like this:
The union is a function which will be called from main.
Code:
void unija(int *x, int *y, int lenx, int leny)
{
int i,j,k,niz[???]; // I have a problem with this length, I tried to proceed it from main
// it would be a sum of lengths of this two arrays but I have
// probably made a mistake since it doesn't work
for(i=0;i<lenx;i++)
{
for(j=0;j<leny;j++)
{
if(*(x+i)!=*(y+j))
niz[k]=*(x+i);
k++;
}
for(j=0;j<leny;j++)
{
if(*(x+i)=<>*(y+j))
niz[k]=*(y+i);
k++;
}
}
}
anyway, I got stuck here, and I'm not sure if this code is good for anything anymore as I made changes so many times. I hope you could help me.