R
ritchie
Hi,
I am writing for some help with editing a linked list.
I would be gratful if anybody has the time to take a look at this.
I am trying to edit a node by entering a date as a key.
If an existing date is entered then you can edit the specified node.
I have the date defined as a nested structure and it is in three parts
(ie: yyyy, mm, dd ) and referenced by the main structure.
My problem is how do I refer to the full date in the edit function to
check if the date entered is a valid date (ie: already stored in the
list) ?
I have tried this but with no luck.
Has anyone got any idea where i'm going wrong?
Also, is my edit function correct?
Any help would be much aprechiated.
Thanks in advance,
Ritchie
------------ code -------------
struct orderDate {
int year;
int month;
int day;
};
typedef struct orderDate OrderDate;
struct node {
OrderDate order_date;
int name
.
.
struct node *next;
};
typedef Node *nPtr;
.
.
.
/***iEdit is the node (date entered) to be edited***/
void editList( NodePtr *sPtr, int iEdit )
{
NodePtr currPtr, prevPtr = NULL;
if( *sPtr == NULL ) {
printf( "List empty\n" );
}
else
if( iEdit == (*sPtr)->order_date ) //PROBLEM HERE
{
printf("Enter new value: "); scanf("%d", &(*sPtr)->name);
...
----------------end--------------------------------
I am writing for some help with editing a linked list.
I would be gratful if anybody has the time to take a look at this.
I am trying to edit a node by entering a date as a key.
If an existing date is entered then you can edit the specified node.
I have the date defined as a nested structure and it is in three parts
(ie: yyyy, mm, dd ) and referenced by the main structure.
My problem is how do I refer to the full date in the edit function to
check if the date entered is a valid date (ie: already stored in the
list) ?
I have tried this but with no luck.
Has anyone got any idea where i'm going wrong?
Also, is my edit function correct?
Any help would be much aprechiated.
Thanks in advance,
Ritchie
------------ code -------------
struct orderDate {
int year;
int month;
int day;
};
typedef struct orderDate OrderDate;
struct node {
OrderDate order_date;
int name
.
.
struct node *next;
};
typedef Node *nPtr;
.
.
.
/***iEdit is the node (date entered) to be edited***/
void editList( NodePtr *sPtr, int iEdit )
{
NodePtr currPtr, prevPtr = NULL;
if( *sPtr == NULL ) {
printf( "List empty\n" );
}
else
if( iEdit == (*sPtr)->order_date ) //PROBLEM HERE
{
printf("Enter new value: "); scanf("%d", &(*sPtr)->name);
...
----------------end--------------------------------