Click here to Skip to main content
15,923,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCharacter(like u)? Pin
imran_rafique31-Oct-02 16:17
imran_rafique31-Oct-02 16:17 
AnswerRe: Character(like u)? Pin
Christian Graus31-Oct-02 16:47
protectorChristian Graus31-Oct-02 16:47 
GeneralRe: Character(like u)? Pin
Le centriste31-Oct-02 18:19
Le centriste31-Oct-02 18:19 
GeneralRe: Character(like u)? Pin
Christian Graus31-Oct-02 19:18
protectorChristian Graus31-Oct-02 19:18 
GeneralRe: Character(like u)? Pin
includeh1031-Oct-02 23:41
includeh1031-Oct-02 23:41 
GeneralRe: Character(like u)? Pin
Christian Graus1-Nov-02 0:36
protectorChristian Graus1-Nov-02 0:36 
GeneralRe: Character(like u)? Pin
Gary R. Wheeler2-Nov-02 3:54
Gary R. Wheeler2-Nov-02 3:54 
GeneralLinked List Problem (PROBLEM SOLVED -- THANKS TO ALL) Pin
Nick Parker31-Oct-02 13:38
protectorNick Parker31-Oct-02 13:38 
I am really getting frustrated with this, so I finally decided to ask. If I leave the code highlighted red in, the application gets stuck in an infinite loop (I think), however if I take it out the application bombs. Does anyone have any suggestions/what might I be missing here? Thanks in advance. Smile | :)

int records::InsertNode(char m_last_name[], char m_first_name[], long m_ssan)
{
	ListNode *NewNode, *NodePtr, *PreviousNode;

	// Allocate a new node & store values
	NewNode = new ListNode;
	strcpy(NewNode->last_name, m_last_name);
	strcpy(NewNode->first_name, m_first_name);
	NewNode->ssan = m_ssan;
	
	// If there are no nodes in the list
	// make NewNode the first node
	if (!Head)
	{
		Head = NewNode;
		NewNode->Next = NULL;
	}
	else	// Otherwise, insert NewNode at end
	{
		// Initialize NodePtr to head of list
		NodePtr = Head;
		

		<font color="red">PreviousNode = NodePtr;</font>

		// Skip all nodes whose Value member is less
		// than m_ssan.

		while (NodePtr != NULL && NodePtr->ssan < m_ssan)
		{	
			PreviousNode = NodePtr;
			NodePtr = NodePtr->Next;
		}

		// Insert the node after the one pointed to
		// by PreviousNode and before the one pointed to
		// by NodePtr.
		PreviousNode->Next = NewNode;
		NewNode->Next = NodePtr;
	}
	return 0;
}


Nick Parker

May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing



GeneralRe: Linked List Problem Pin
Tim Smith31-Oct-02 13:51
Tim Smith31-Oct-02 13:51 
GeneralRe: Linked List Problem Pin
Nick Parker31-Oct-02 14:06
protectorNick Parker31-Oct-02 14:06 
GeneralRe: Linked List Problem Pin
ColinDavies31-Oct-02 14:11
ColinDavies31-Oct-02 14:11 
GeneralRe: Linked List Problem Pin
Nick Parker31-Oct-02 14:13
protectorNick Parker31-Oct-02 14:13 
GeneralRe: Linked List Problem Pin
Alexander Wiseman31-Oct-02 15:06
Alexander Wiseman31-Oct-02 15:06 
GeneralRe: Linked List Problem Pin
Nick Parker31-Oct-02 15:19
protectorNick Parker31-Oct-02 15:19 
GeneralRe: Linked List Problem (PROBLEM SOLVED -- THANKS TO ALL) Pin
KarstenK1-Nov-02 1:00
mveKarstenK1-Nov-02 1:00 
GeneralFrustrating new operator problem Pin
Sparticus31-Oct-02 12:18
Sparticus31-Oct-02 12:18 
GeneralRe: Frustrating new operator problem Pin
ian mariano31-Oct-02 12:27
ian mariano31-Oct-02 12:27 
GeneralRe: Frustrating new operator problem Pin
Tim Smith31-Oct-02 12:38
Tim Smith31-Oct-02 12:38 
Generaldialogs Pin
Lucky200231-Oct-02 10:12
Lucky200231-Oct-02 10:12 
GeneralRe: dialogs Pin
Christian Graus31-Oct-02 10:25
protectorChristian Graus31-Oct-02 10:25 
GeneralRe: dialogs Pin
Lucky200231-Oct-02 10:33
Lucky200231-Oct-02 10:33 
GeneralRe: dialogs Pin
Christian Graus31-Oct-02 10:50
protectorChristian Graus31-Oct-02 10:50 
GeneralRe: dialogs Pin
Lucky200231-Oct-02 11:03
Lucky200231-Oct-02 11:03 
GeneralRe: dialogs Pin
Christian Graus31-Oct-02 11:10
protectorChristian Graus31-Oct-02 11:10 
GeneralRe: dialogs Pin
Lucky200231-Oct-02 11:25
Lucky200231-Oct-02 11:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.