circular linklist

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2007
Posts: 7
Reputation: paeez is an unknown quantity at this point 
Solved Threads: 0
paeez paeez is offline Offline
Newbie Poster

circular linklist

 
0
  #1
Mar 22nd, 2007
here is a code about a circularlinklist,which its nodes contain a number between 1 to 2048(first node contains 1 and the lastnode contains 2048) and pointer P that refers to the last node...what does this code do?
  1. while(p->next!=p){
  2. p->next=p->next=->next;
  3. p=p->next;
  4. }
  5. cout<< p->info;
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: circular linklist

 
0
  #2
Mar 22nd, 2007
> p->next=p->next=->next;
It doesn't do anything, because it won't compile.

Also, since you keep changing p, your condition will never fail (loop forever, chasing your tail like some demented dog).
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC