Ok I am trying to iterate for a number of times through an array of integers and
ID: 3626559 • Letter: O
Question
Ok I am trying to iterate for a number of times through an array of integers and compare each index in the array to a member of another struct in a linked list. I am trying to see if the two ints are equal, and if they are, print so. With my short code here, I am getting the incorrect input. the ints in the struct are in numerical order and the ints in the array arent. What I need to do is re-search the entire linked list each time I iterate through an index but I can seem to get it right.CODE:
for(i = 0; i < pNew -> numItemsOnList; i+=2)
{
temp = productlist;
while(temp != NULL){
if(temp -> itemNum == pNew -> itemsPurchased[i])
{
printf("%s %s's item, the %s was found in list ", pNew -> firstName, pNew -> lastName, productlist -> itemName);
}
//if(temp -> itemNum != pNew -> itemsPurchased[i])
temp = temp -> next;
}
for whatever reason, my code is not searching each index through the entire linked list before it moves on to the next index...any help would be great.
Explanation / Answer
if u can provide the full program to see the problem coz i can`t follow with your program here
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.