Hi, can someone explain to me why de following code does crash the program after it reached the NULL pointer????
the max value of Searchvalue = 5 but when i make it 6 it crashes my program.
Code:
struct parkinglot* FindParkingLot (struct parkinglot* StartPtr, int SearchValue)
{ // start at head of the list
struct parkinglot* HuidigePtr = StartPtr;
while (HuidigePtr != NULL && HuidigePtr->Vak != SearchValue) {
HuidigePtr = HuidigePtr->VolgendePtr;
}
if (HuidigePtr->Vak != SearchValue)
return (NULL);
else
return (HuidigePtr);
};
regards Fred