Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find out the union of two character arrays?

Answer Posted / prakashdasari

char *str1,*str2,*res;
while(*str1!=NULL)
str++;
while(*str2!=NULL)
{
*str1 == *str2;
str1++;
str2++;
}
*str1 = '\0';
//so total string is in one string ie str1 itself;
//now i will remove duplicates from entire string
for(i=0;str[i]!=NULL;i++)
{
for(j=0;str[j]!=NULL;j++)
{
if(str[i]==str[j])
{
flag = 1;break;
}
else flag = 0;
}
if(flag == 0)
{
*res = str[i];
res++;
}
*res = '\0';
}
now resultant string (res) is union of two character
arrays....

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are header files in c?

1055


How arrays can be passed to a user defined function

1006


Which are low level languages?

1079


explain what are pointers?

995


Tell us bitwise shift operators?

1076


What are the disadvantages of external storage class?

1040


Differentiate between calloc and malloc.

1248


What does %p mean c?

1053


Are bit fields portable?

1140


Why does everyone say not to use gets?

1088


How old is c programming language?

994


Explain union.

1155


Where register variables are stored in c?

947


Can you apply link and association interchangeably?

1111


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1116