Hi,
I am a newbie with C++ , yaa.. have been fighting with C and now progressed towards C++ , can anybody suggest some good site for LINKED LIST
Thank You
This is a discussion on linked list within the C++ Programming forums, part of the General Programming Boards category; Hi, I am a newbie with C++ , yaa.. have been fighting with C and now progressed towards C++ , ...
Hi,
I am a newbie with C++ , yaa.. have been fighting with C and now progressed towards C++ , can anybody suggest some good site for LINKED LIST
Thank You
Last edited by vivek_kumbhar; 08-18-2003 at 06:11 AM.
Thanking You,
Vivek J. Kumbhar
CProgramming.com has a pretty good Linked List tutorial.
Link: http://www.cprogramming.com/tutorial/lesson15.html
Give me a bad reputation!!!
I wrote this a while ago... you can take the source if you want, seeing as it's nothing more than a pretty standard linked list... and open source rules...
Code:/* linked.cpp => Linked Lists These are notes for myself that will help with linked lists. It is a working Linked list that, when run, will print out every List Item in the form of it's number in the line. Major_Small */ #include <iostream> using std::cout; using std::endl; int main() { int i; //loop control variable struct list; //structure declaration - needed for typedef typedef list *ptrList; //typedef - makes life easier struct list //structure { int variable; //this list item's data ptrList link; //pointer to next list item (note typedef use here) }; ptrList curr; //current list item in focus ptrList next; //next list item in line ptrList head; //first list item in line head=new list; //create first list item curr=head; //point 'curr' to first list item curr->link=NULL; //set first list item's pointer to NULL so it doesn't look //for something that doesn't exist for(i=0;i<25;i++) //runs 25 times { next=new list; //creates a new list item curr->link=next; //current list item set to point to next list item curr->variable=i+1; //current variable gets something curr=next; //focus changed to next list item } /* AT THIS POINT, THE LINKED LIST IS COMPLETE - WHAT IS BELOW IS TO PRINT OUT THE LINKED LIST. THE CONSTANTS IN THE LIST ARE THAT 'HEAD' IS THE FIRST LIST ITEM, AND 'NEXT' IS THE LAST LIST ITEM. THE LAST LIST ITEM SHOULD HAVE ITS POINTER POINTING TO NULL */ curr->link=NULL; //last list item's pointer set to NULL for same reason curr=head; //current points back to first - NOT NECESSARY - for printing for(i=0;i<25;i++) //runs 25 times to print { cout<<curr->variable<<endl; //print what is in curr (ini to head above) curr=curr->link; //move focus along list } return 0; }
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT
Hey unanimous no matter how hard I try, I just don't get your sig.
Well, there are a few things wrong with your code:
1) It does not work.
2) It does not work.
3) It does not work.
Hope this helps.
ITs not that difficult, I'm a pervert.
Give me a bad reputation!!!