Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Know this usefu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 43626 of 47563
Post > Topic >>

Know this useful things...........

by Ramu <ramkumar2k888@[EMAIL PROTECTED] > Mar 1, 2008 at 09:47 PM

How do you write a function that can reverse a linked-list?

void reverselist(void)
{
if(head==0)
return;
if(head->next==0)
return;
if(head->next==tail)
{
head->next = 0;
tail->next = head;
}
else
{
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur-> next = head;

for(; curnext!=0; )
{
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
}
curnext->next = cur;
}
}

What is public, protected, private?

*	Public, protected and private are three access specifiers in C++.
*	Public data members and member functions are accessible outside the
class.
*	Protected data members and member functions are only available to
derived cl*****.
*	Private data members and member functions can't be accessed outside
the class. However there is an exception can be using friend cl*****.
 




 4 Posts in Topic:
Know this useful things...........
Ramu <ramkumar2k888@[E  2008-03-01 21:47:05 
Re: Know this useful things...........
"jason.cipriani@[EMA  2008-03-01 22:04:41 
Re: Know this useful things...........
Andrey Tarasevich <and  2008-03-01 23:23:09 
Re: Know this useful things...........
Lutz Altmann <lutz.alt  2008-03-02 07:35:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 8:08:33 CDT 2008.