Help required for programming Link list in c++

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Hello everyone,

I need help in programming the code for link list in C++, i have no software (compiler) and no deep experience in programming.
so, please help me to start programming link list.
i have seen tutorial on Google and on my book but i have not found the concept behind.

like here:->

s
Rich (BB code):
truct node {   int x;   node *next; };
 int main() 
{   node *root;       // This will be the unchanging first node    root = new node; // Now  root points to a node struct   root->next = 0;  // The node root  points to has its next pointer                    //  set equal to a  null pointer   root->x = 5;     // By using the -> operator, you  can modify the node                    //  a pointer (root in this case)  points to. }
 

debjit625

Joined Apr 17, 2010
790
To understand the concept of Link List in C\C++ you have to understand the concept of pointers. So before explaining anything I would like to know do you understand pointers well enough?

i have no software (compiler)

What software compiler??? C\C++ compiler, their are many like open source MinGW with Code::Blocks as IDE or you can use Visual C\C++ compiler, from Microsoft’s website you can download the latest version i.e.. Visual Studio 2010 (Express Edition is free).Or you go for Borland C\C++ compiler.

Good Luck
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Thanks for replying, will Dev c++ will work fine.
and i am not strong in programming whether its pointers. please guide me..!!
 

Thread Starter

RRITESH KAKKAR

Joined Jun 29, 2010
2,829
OK, I am using DEV C++, it is showing error source file not complied...
code is:->
Rich (BB code):
#include <iostream>
int main()
{
using namespace std;
cout << "hey";
system("PAUSE");
return 0;
}
and error listed below are.

i:\gw\lib\crt2.o(.text+0x8) In function `_mingw_CRTStartup':
[Linker error] undefined reference to `__dyn_tls_init_callback'
[Linker error] undefined reference to `__cpu_features_init'
i:\gw\lib\crt2.o(.text+0x8) ld returned 1 exit status
 
Last edited:

debjit625

Joined Apr 17, 2010
790
You have to learn about pointers before learning about Link List... its like before learning to write we learn ABCD...

There is internet, and some good books too like
"Thinking in C++ by Bruce Eckel"
"C++ A Beginner,s Guide by Herbert Schildt"
or by the inventor of the C++ language himself "The Design and Evolution of C++ by Bjarne Stroustrup"

And any compiler will work, as they all compile the code to native machine language, some compiler don't obey the standards, so whatever compiler you use just follow the standard coding practice. While you are learning you don't have to bother about standards.

Your code didn't work because of improper declaration of namespace. It should be like this
#include <iostream>
using namespace std;
int main()
{
cout << "hey";
system("PAUSE");
return 0;
}



Good Luck
 
Top