View Single Post
  #1  
Old 09-15-2007, 05:39 PM
IRuleYouHard IRuleYouHard is offline
Senior Member
 
Join Date: Nov 2006
Location: MS Paint Forum.
Posts: 1,050
Default C Programming Halp! :)

BOOLEAN SequentialSearch(ARRAY_LIST *plist, YEAR targetYear, int *loc)
{
int i; /* loop control variable */
int numFound; /* counts how many found */
BOOLEAN found; /* return value TRUE if success FALSE if not */

numFound = 0; /* set to none in the beginning */
found = FALSE; /* initial setting until a record is found */

/* search through the array list for targets */
for(i = 0; i < plist->count; i++)
{
if (EQ(targetYear, plist->car[i].year)) /* target year is found */
{
loc = loc;
numFound++; /* add one to the count */

/* ********
HERE IS WHERE YOU WILL WANT TO HANDLE DISPLAYING THE CAR RECORD.
EITHER DIRECTLY, OR BY CALLING A FUNCTION TO DO IT
********* */

found = TRUE; /* successfully found at least one record */

}
}
printf("\n\n %d record(s) found that match\n", numFound);
i = 0; /* reset value of i */
return found;
}

This is the function I am calling... the only problem is I don't know what to send it exactly. Who wants to help? [img]/images/graemlins/smile.gif[/img]
Reply With Quote