char *ar[5]; //Array of pointers
let say char * ar[5] contain:
ar[0] = "cat";
ar[1] = "desk";
ar[2] = "desk"
ar[3] = "zoo";
ar[4] = "cat";
how i want to get of any same strings. so in end ar should have the value "cat","desk","zoo".
this is what i have so far but iam not sure if iam doing this right.
for(i = 0; i < 5; i++)
{
for(j = i+1; j < 5; i++)
{
if(ar[i] == ar[j])
{
ar[i] = '\0';
}
}
}
//print
for(i = 0; i < 5; i++)
{
printf("%s",ar[i]);
}
hwoarang69 11 Newbie Poster
histrungalot 32 Junior Poster
hwoarang69 11 Newbie Poster
histrungalot 32 Junior Poster
hwoarang69 11 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.