I am having a problem with this search function
It compares the first node fine. But I am not sure what kind of statement to use to compare the target with the second node and so on
I realize current = current->next; won't work because the error I recieve is "left of 'next' specifies undefined struct/union 'node'"
Does anyone know what I can do to fix this problem?
Code:int Search_List(Header *psList, int z) { int x; char answer[40]; struct node* current = psList->psHead; printf("\n\nWhat City or Zipcode would you like to search for?"); scanf("%s",&answer); if (isalpha(answer[0]) == 0) { //search for zip current = psList->psHead; for(x=0;x<z;x++) { if(strcmp(answer, current,5)== 0) { system("cls"); printf("\nThe Zipcode was found with %d comparisons",x+1); printf("\nZipcode = %s City = %s State = %s",psList->psHead->zipcode, psList->psHead->city, psList->psHead->state); printf("\nPopulation = %d Longitude = %-.2f latitude = %-.2f\n",psList->psHead->population, psList->psHead->longitude, psList->psHead->latitude); x=z; } else { current = current->next;//problem is here } } }



LinkBack URL
About LinkBacks


