dimanche 8 octobre 2017

Head pointer empty

Why do I keep getting nothing in path error when I submit the following code?

city* addCity(city *head, city *previous, string cityName )
{   city* add = new city;
    add->name = cityName;
    city* temp = new city;
    temp = head;
    while(temp != NULL){
        if(temp == previous){
        temp->next = add;
        }
        head = temp;
    } 
    return temp;
    }

Aucun commentaire:

Enregistrer un commentaire