All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Programmer's Corner

Notices

Programmer's Corner Discussion forum for all aspects of programming and software engineering. Any software programming language welcome: C, C++, C#, Fortran, Java, Matlab, etc.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 05-02-2012, 03:28 PM
RRITESH KAKKAR's Avatar
RRITESH KAKKAR RRITESH KAKKAR is offline
Senior Member
 
Join Date: Jun 2010
Location: Earth
Posts: 1,351
Send a message via MSN to RRITESH KAKKAR
Default Help required for programming Link list in c++

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. }
Select All
Reply With Quote
  #2  
Old 05-02-2012, 05:03 PM
debjit625's Avatar
debjit625 debjit625 is offline
Senior Member
 
Join Date: Apr 2010
Location: Blue planet...
Posts: 790
Default

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?

Quote:
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
__________________
Debjit Roy
__________________
A man would do nothing,if he waited until he could do it so well,that no one would find fault with what he has done.
- CARDINAL NEWMAN
Reply With Quote
The Following User Says Thank You to debjit625 For This Useful Post:
RRITESH KAKKAR (05-02-2012)
  #3  
Old 05-02-2012, 05:08 PM
RRITESH KAKKAR's Avatar
RRITESH KAKKAR RRITESH KAKKAR is offline
Senior Member
 
Join Date: Jun 2010
Location: Earth
Posts: 1,351
Send a message via MSN to RRITESH KAKKAR
Default

Thanks for replying, will Dev c++ will work fine.
and i am not strong in programming whether its pointers. please guide me..!!
Reply With Quote
  #4  
Old 05-02-2012, 05:21 PM
RRITESH KAKKAR's Avatar
RRITESH KAKKAR RRITESH KAKKAR is offline
Senior Member
 
Join Date: Jun 2010
Location: Earth
Posts: 1,351
Send a message via MSN to RRITESH KAKKAR
Default

Quote:
Visual Studio 2010 (Express Edition is free).
I have seen this it was file of Gb's, so i ned link for down loading small Compiler software..!!
Reply With Quote
  #5  
Old 05-02-2012, 06:32 PM
cheezewizz cheezewizz is offline
Member
 
Join Date: Apr 2009
Posts: 82
Default

Mingw (as mentioned by Debjit above) is always a good shout. http://sourceforge.net/projects/ming...ingw-get-inst/
Reply With Quote
The Following User Says Thank You to cheezewizz For This Useful Post:
RRITESH KAKKAR (05-03-2012)
  #6  
Old 05-03-2012, 01:12 AM
RRITESH KAKKAR's Avatar
RRITESH KAKKAR RRITESH KAKKAR is offline
Senior Member
 
Join Date: Jun 2010
Location: Earth
Posts: 1,351
Send a message via MSN to RRITESH KAKKAR
Default

OK, The software has been downloaded so, please guide me how to start single link list program in C++...?
Reply With Quote
  #7  
Old 05-03-2012, 05:17 AM
RRITESH KAKKAR's Avatar
RRITESH KAKKAR RRITESH KAKKAR is offline
Senior Member
 
Join Date: Jun 2010
Location: Earth
Posts: 1,351
Send a message via MSN to RRITESH KAKKAR
Default

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;
}
Select All
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 by RRITESH KAKKAR; 05-03-2012 at 06:03 AM.
Reply With Quote
  #8  
Old 05-03-2012, 09:43 AM
RRITESH KAKKAR's Avatar
RRITESH KAKKAR RRITESH KAKKAR is offline
Senior Member
 
Join Date: Jun 2010
Location: Earth
Posts: 1,351
Send a message via MSN to RRITESH KAKKAR
Default

OK, now ia m using code block and it is working fine for me..!!
So, please start with programing of single link list.
Reply With Quote
  #9  
Old 05-03-2012, 08:56 PM
stahta01 stahta01 is offline
Senior Member
 
Join Date: Jun 2011
Posts: 133
Default

Short how to on link lists
http://www.cprogramming.com/tutorial/lesson15.html

Tim S.
Reply With Quote
The Following User Says Thank You to stahta01 For This Useful Post:
RRITESH KAKKAR (05-04-2012)
  #10  
Old 05-04-2012, 09:48 AM
debjit625's Avatar
debjit625 debjit625 is offline
Senior Member
 
Join Date: Apr 2010
Location: Blue planet...
Posts: 790
Default

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
Quote:
#include <iostream>
using namespace std;
int main()
{
cout << "hey";
system("PAUSE");
return 0;
}


Good Luck
__________________
Debjit Roy
__________________
A man would do nothing,if he waited until he could do it so well,that no one would find fault with what he has done.
- CARDINAL NEWMAN
Reply With Quote
The Following User Says Thank You to debjit625 For This Useful Post:
RRITESH KAKKAR (05-05-2012)
Reply   Post New Thread

Tags
, , ,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help required for this SMPS Battery Charger xyz9915 General Electronics Chat 17 11-20-2010 08:24 AM
What sort of certification is required to sell electronics? AltecDarpa General Electronics Chat 4 06-04-2010 10:29 PM
Counter Required in 12VDC Simple Circuit rcayne The Projects Forum 1 09-12-2009 01:26 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:45 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.