memory allocation newbie problem
I have a program that searches and outputs prime-numbers. I use linked-list to store these numbers (because I need to learn dynamic memory allocation). It's made of struct defined like this:
Code:
struct Tmylist {
int value;
Tmylist *next;
};
It works great. User enters a number and program searches through interval (0, number> and stores all prime-numbers found within this interval into my linked-list. Problem is, when user enters number greater than 25900 (or something near this). It crashes. Someone told me my problem are segments in memory. He told me I have only one memory segment available for allocating with new. I use new like this:
Code:
Tmylist *beggining = new Tmylist;
and maybe I filled the segment. Could anyone help me?