ok i am having a linked list problem..here is code...and explanation is uner the code...
how do i lin the train cars together...i triedCode:#include <iostream> using namespace std; struct train { int passengers; train* pnext_car; }; int main(void) { train (*whole_train) = new train[30]; // link the trains together for(int i = 0; i <= 30; i++) { // HOW?? to link together... } return 0; }
*(whole_train)[i]->pnext_car = &(whole_train)[i+1];
it doesnt work..please help