Hi
Please help me. I have done these program please correct where is the error. I tried to find out but I have not yet got the correct error. This is the code to find union of two arrays.
Code:
main()
{
int x[5]={1,3,4,6,8},b[5]={2,4,5,6,10},i,d,k,c[10];
for(i=0;i<5;i++)
{
for(d=0;d<5;d++)
{
if(x[i]!=b[d])
{
c[k]=x[i];
k++;
}
else
c[k]!=x[i];
}
}
strcat(b,c);
printf("%s",b);
}
This is the code to find intersection of two arrays
Code:
main()
{
int x[5]={1,3,4,6,8},b[5]={2,4,5,6,10},i,d,k,c[10];
for(i=0;i<5;i++)
{
for(d=0;d<5;d++)
{
if(x[i]==b[d])
{
c[k]=x[i];
k++;
}
else
c[k]!=x[i];
}
}
printf("%s",b);
}
Please check were is the error. Thanks in advance.
Bookmarks