I’m trying to fill the already created linked list by traversing the linked list and then fill each node data with the user input but for some reason after 1040 times it stops asking further values. However let’s say I have link list of size 1000 it will work just fine but for more than size of 1040 It doesn’t prompt the user. I’m not entering value each time I generated random 1100 elements which I’m copying to the console.
inline void myArray<T>::init() {
Node<T>* temp = head;
T input;
while(temp!=NULL) {
cin >> input;
temp->data = input;
temp = temp->next;
}
}
If I do something like this, it works just fine doesn’t matter what the size of link list is…
inline void myArray<T>::init() {
Node<T>* temp = head;
while(temp!=NULL) {
temp->data = 5;
temp = temp->next;
}
}
So, Now I’m thinking the error has something to do with the input taking