943,589 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 4404
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Oct 25th, 2007
0

Re: xor linked list

>but don't know how to use cast. can you help me?
That's something that any C++ book or reference will tell you how to use. It would be "cast" or "type cast" in the index.
Reputation Points: 44
Solved Threads: 8
Junior Poster in Training
Ptolemy is offline Offline
62 posts
since Oct 2007
Oct 25th, 2007
0

Re: xor linked list

thank you
:-)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phoenixlsk is offline Offline
6 posts
since Oct 2007
Oct 25th, 2007
0

Re: xor linked list

Try reading some of the sticky posts that are labels Read Me: to learn good posting techniques...
Moderator
Reputation Points: 3275
Solved Threads: 890
Posting Sage
WaltP is offline Offline
7,717 posts
since May 2006
Mar 13th, 2009
0

Re: xor linked list insert in C++

class xll
{
public:
int data;
unsigned long link;
};

class xlist
{
xll *head,*tail;
xlist(){head = NULL;tail = NULL}
void insert(int);
};
void xlist :: insert (int ele)
{
xll *node = (xll*) malloc (sizeof(xll));
node->data = ele;
xll *temp = head,*prev = NULL;
while(temp != NULL)
{
next = (xll *) (temp->link ^ (unsigned long) prev);
prev = temp;
temp = next;
}
if(prev == NULL)
head = node;
else
{
node->link ^= (unsigned long) prev ^ (unsigned long) temp;
prev->link ^= (unsigned long) temp ^ (unsigned long) node;
temp->link ^= (unsigned long) prev ^ (unsigned long) node;
}
}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
manojthesingham is offline Offline
1 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Dice rolling program... Output trouble
Next Thread in C++ Forum Timeline: I can't use one member function in another member function





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC