what i want to do is to compare the current read in string 'street_name' which has a single name then compares then reads a new name. And a previously read in string array in 'comp_street_name' which has 20 names in a string array.all strings are read in and working fine.
i want it to compare 'street_name' to the 1st 'comp_street_name' and keep going through comparing until the end of the 'comp_street_name' array.
both strings are dynamic ones. check the declaration below. the 1st string is in a struct with a pointer. the 2nd string is just a global array. 'st_name' in the for loop is just a counter of how many 'comp_street_name's there are. 'a' is passed in from the read function and is just where the read in string is.
DECLARATION:
Code:
char street_name[MAX][STR_MAX];
char comp_street_name[MAX][STR_MAX];
PART OF FUNCTION:
Code:
for(b = 0; b < st_name; b++)
{
if(strcmp(fptr->street_name[a][b], comp_street_name[a][b]) == 0) /* Compare strings to find a valid address */
{
check++; /* Add one to checker for correct address part */
}
}