I am getting segmentation fault in this code but i cant figure out why. I know a segmentation fault happens when a pointer is NULL, or when it points to a random memory address.
q = p;
while(q -> link != NULL){
q = q -> link;
}
t = new data;
t -> city = cityName;
t -> latitude = lat;
t -> longitude = lon;
q -> link = t;
This is the error am actually getting in console
Or written out:
line 33: 2219 Segmentation fault sh "${SHFILE}"