Re: help with C
- From: "sulays" <sscheell2000@xxxxxxxxx>
- Date: 20 Nov 2005 09:11:08 -0800
Im trying create a link list by accepting initial input from a file
<that part of my program is working ok>
the link list must be maintained in increasing alphabetical order base
on the employee's last name
employees with the same last name I need to listed in alphabetical
order based on the first name and if the have the same last name and
first name need to listed in ascending order based on employee id
trying to do the last name for now and see how it works
EIS* inserting(EIS *fPtr,EIS *tempPtr)
{
EIS *prev = NULL;
EIS *curr = NULL;
if(fPtr == NULL)< this is checking if the list is empty>
return tempPtr;
curr = prev = fPtr;<this is setting the other pointers to the first
node>
tempPtr->nextnode = curr; <this one is for the second node>
while(curr != NULL)
{
if(strcmp(tempPtr->lastname,curr->lastname) > ZEROI)
{
if(curr == prev)
return tempPtr;
else
prev->nextnode = tempPtr;
return fPtr;
}
else
{
prev = curr;
curr = curr->nextnode;
}
}
prev->nextnode = tempPtr;
return fPtr;
}
I dont know why is not working
.
- References:
- help with C
- From: sulays
- Re: help with C
- From: Nick Keighley
- Re: help with C
- From: sulays
- Re: help with C
- From: Nick Keighley
- help with C
- Prev by Date: Re: what is the use of void pointer?
- Next by Date: Re: [OT] Re: wchar_t
- Previous by thread: Re: help with C
- Next by thread: Re: help with C
- Index(es):
Relevant Pages
|