It should read more like this:
typedef struct ListItem
{
char* pc_Serial_Number;
int n_Availability;
char* pc_Color;
char* pc_IPAddress;
struct ListItem *pstNextListItem;
}ListItem_t;
ListItem_t stoListItem;
ListItem_t *stoNext;
stoNext = &stoMVCIListItem;
while (stoNext != 0)
{
printf("\n Device (%d)",iMVCI_No);
printf("\n SerialNumber = %s \n Availability = %d" "\n Colour = %s \n IP = %s",
stoNext->,pc_Serial_Number,
stoNext->n_Availability,
stoNext->pc_Color,
stoNext->pc_IPAddress
);
i_No++;
stoNext=stoNext->pstNextListItem;
}
i_No=0;
That's all! The if block can be eliminated completely and all the nescessary work is now done in the while loop.
Best Regards,
-MRB