Hi,

Following code snippet show the maximum number of nodes to be created. I execute this code and show the count : 7874

My problem is that I want to create more node than 7874. I have compiled this code by Turboc version 3.0 on Windows XP.

#include <stdio.h>
#include <stdlib.h>

struct List{
    int no;
    List *next;
};

List *first;
int Test(){
    int i=0;
    first=new List;
    List *t=first;
    while(1) {
	if(t==NULL)
	    break;
	t->no=i;
	t->next=new List;
	t=t->next;
	i++;
    }
   return i;
}

int main() {
    printf("\nTotal Nodes allocated : %d",Test());
}

you can't do it with that compiler. Get yourself a free copy of a modern compiler and it will create all the nodes you want. There are several free compilers, such as Code::Blocks, Dev-C++, and VC++ 2008 Express. Just google for them and you will find them.

I ran your program on my computer and VC++ 2008 Express and it had allocated over 3,000,000 nodes before I stopped it.

>>There are several free compilers, such as Code::Blocks, Dev-C++, and VC++ 2008 Express.
( Note to OP: I am talking to Ancient Dragon, this has got nothing to do with you)
I never knew Code::Blocks and Dev-C++ are compilers!! I thought they were IDEs ;)
Or am I sensing it right?

Comments
good observation :)
Absolutely right :) !

>>There are several free compilers, such as Code::Blocks, Dev-C++, and VC++ 2008 Express.
( Note to OP: I am talking to Ancient Dragon, this has got nothing to do with you)
I never knew Code::Blocks and Dev-C++ are compilers!! I thought they were IDEs ;)
Or am I sensing it right?

Yes you're right, but I think Ancient Dragon actually wanted to simplify it for the OP :P ...

>>Yes you're right, but I think Ancient Dragon actually wanted to simplify it for the OP
This was not required Tux, (I was sensing it right) It is not right for OP to know that he doesn't know

To create a linked list it might be easier to use the list-container from the Standard Template Library, it's still a suggestion ...

By the way, Turbo C Compilers are already quite old, I recommend you to switch to a new one like MinGW (which comes with Code::Blocks and Dev-C++) or the Free Borland Compiler (but it starts getting dated :))

>>There are several free compilers, such as Code::Blocks, Dev-C++, and VC++ 2008 Express.
( Note to OP: I am talking to Ancient Dragon, this has got nothing to do with you)
I never knew Code::Blocks and Dev-C++ are compilers!! I thought they were IDEs ;)
Or am I sensing it right?

Technically you are right, they are IDEs. But they are distributed with the programs that do the actual compiling, the libraries, and the header files. So IMHO the term "compiler" encompasses all of those packages.

Dear Ancient Dragon,

Thanks for you valuable comments. I found that a far pointer provides more addressing capability and I have used same code as it was published in my post with little modification and compiled with Turboc 3.0.

Thanks.

Comments
Nope, you just dug a deeper hole for your future self. Get with the current century, and get a compiler which is compatible with your actual OS and processor

Why are you putting so much effort into shoehorning your code onto a dinosaur of a compiler? Yea, you may have "fixed" this issue but that's only one of hundreds of problems you'll encounter with a compiler that should have stopped being used 10 years ago. Let dead compilers lie along with all the other old libraries and coding practices they encourage.

Comments
You've gotta wonder sometimes why people buy modern expensive machines only to replace the engine with an elastic band, then wonder why they can't access 99% of the machine :D
Very clearly explanation :)
This question has already been answered. Start a new discussion instead.