Hi i am trying to make a link list.The data to the link list will be added from the command line . example of a command line will --- I 45 here 45 is the data to be added.(time)
struct item
{ UINT time ; // time in tics which is used to order the list.
UINT id ; // penguin id number.
UINT event ; // event this item describes.
struct item *next ; // pointer to next item in list.
} ;
struct item *head_ptr ;
struct item *work_ptr ;
int main(int argc, char *argv[])
{
for(int i=1; i<argc; i++)
{
if (!strcmp(argv[i],"I"))
{
struct item
{ UINT time ; // time in tics which is used to order the list.
UINT id ; // penguin id number.
UINT event ; // event this item describes.
struct item *next ; // pointer to next item in list.
} ;
struct item *head_ptr ;
struct item *work_ptr ;
int main(int argc, char *argv[])
{
for(int i=1; i<argc; i++)
{
if (!strcmp(argv[i],"I"))
{
Ah.. I see... Now you have only 1 value but you plan on filling the complete struct? Do you want to save the number 45 or the representation of the characters '4' and '5'?