Help required for programming Link list in c++

Discussion in 'Programmer's Corner' started by RRITESH KAKKAR, May 2, 2012.

  1. RRITESH KAKKAR

    RRITESH KAKKAR Thread Starter Well-Known Member

    Joined:
    Jun 29, 2010
    Messages:
    1,353
    Location:
    India
    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
    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. }
  2. debjit625

    debjit625 Active Member

    Joined:
    Apr 17, 2010
    Messages:
    790
    Location:
    Blue planet...
    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?


    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
    RRITESH KAKKAR likes this.
  3. RRITESH KAKKAR

    RRITESH KAKKAR Thread Starter Well-Known Member

    Joined:
    Jun 29, 2010
    Messages:
    1,353
    Location:
    India
    Thanks for replying, will Dev c++ will work fine.
    and i am not strong in programming whether its pointers. please guide me..!!
  4. RRITESH KAKKAR

    RRITESH KAKKAR Thread Starter Well-Known Member

    Joined:
    Jun 29, 2010
    Messages:
    1,353
    Location:
    India
    I have seen this it was file of Gb's, so i ned link for down loading small Compiler software..!!
  5. cheezewizz

    cheezewizz Active Member

    Joined:
    Apr 16, 2009
    Messages:
    82
    RRITESH KAKKAR likes this.
  6. RRITESH KAKKAR

    RRITESH KAKKAR Thread Starter Well-Known Member

    Joined:
    Jun 29, 2010
    Messages:
    1,353
    Location:
    India
    OK, The software has been downloaded so, please guide me how to start single link list program in C++...?
  7. RRITESH KAKKAR

    RRITESH KAKKAR Thread Starter Well-Known Member

    Joined:
    Jun 29, 2010
    Messages:
    1,353
    Location:
    India
    OK, I am using DEV C++, it is showing error source file not complied...
    code is:->
    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: May 3, 2012
  8. RRITESH KAKKAR

    RRITESH KAKKAR Thread Starter Well-Known Member

    Joined:
    Jun 29, 2010
    Messages:
    1,353
    Location:
    India
    OK, now ia m using code block and it is working fine for me..!!
    So, please start with programing of single link list.
  9. stahta01

    stahta01 Member

    Joined:
    Jun 9, 2011
    Messages:
    133
  10. debjit625

    debjit625 Active Member

    Joined:
    Apr 17, 2010
    Messages:
    790
    Location:
    Blue planet...
    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


    Good Luck
    RRITESH KAKKAR likes this.
Similar Threads
Forum Title Date
Programmer's Corner avr-32 programming in C - example code required Oct 14, 2005
Programmer's Corner clarification required regarding VHDL. Apr 7, 2014
Programmer's Corner clarification required regarding VHDL. Jan 27, 2014
Programmer's Corner PWM required for Inverter.... May 14, 2013
Programmer's Corner How to judge required PC power for an application? Jan 25, 2013

Share This Page