How to copy one string array to another excluding one string
Hi
I have a string array with the following data
AAA BBB CCC DDD
and I want to copy all the above data expect BB to another string array. I have the below. inputarray is my source string array and I want to write it to outputarr.
The problem I have is as seen below where data does not get copied consecutively to outputarr. Can some help me on this? Thanks.
Code:
int remBBB(char *inputarray[], char *outputarr[], int count)
{
printf ("In remBBB\n");
int x=0;
int count1=0;
char value[MAX_PATH]={NULL};
sprintf (value,"BBB");
for (x=0; x < count; x++)
{
if (strcmp(inputarray[x],value) != 0)
{
memcpy(outputarr, inputarray, sizeof(outputarr));
count1++;
}
}
return count1++;
}