Double Linked List Help



Could someone please explain to me how to create the beginning of a
double linked list with the following information. I think I know how
to create the add, delete, delete all, print, append and so on methods
but I can't get a grasp on where to start.

Here is the information:

A double linked list called NAMES which will contain all C like
identifiers of less than
256 characters long identified in the input file F. Each identifier
will be represented by
a triple (I, length, string) where I is used to identify the type of
the object as being an
identifier, length is an integer representing the length of the
identifier in characters, and
string is a string of characters representing the identifier itself.

A double linked list called NUMBERS which will contain all C like
numbers of less than
256 characters long identified in the input file F. Each number will be
represented by a
triple (N, length, string) where N is used to identify the type of the
objects as being a
number, length is an integer representing the length of the number in
characters, and
string is the string of characters representing the number itself.

Here is the main start to the program:
This program works with other another program if you would like to see
please state so and I will post that program. The scan.c scans a
function and the scanner returns a pair (i, j) of Type String where i
is the column number and j is the line number in F.

#include "scan.h"

main (argc, argv)
int argc;
char *argv[];
{
extern TKN get_token(FILE *);
TKN Token;
FILE *Input;
int TokenNr = 1, LineNr = 1, Done = 0, k;
Input = fopen(argv[1], "r");
while (!Done)
{
Token = get_token( Input );
switch (Token.Code)
{
case 'I':
{
/* process identifier */
printf("(%d,%d) Symbol: Identifier %s\n",TokenNr,
LineNr,Token.String);
TokenNr = TokenNr+1;
break;
}
case 'N':
{
/* process integer number */
printf("(%d,%d) Symbol: Integer number
%s\n",TokenNr,LineNr,Token.String);
TokenNr = TokenNr+1;
break;
}
case 'F':
{
/* process real number */
printf("(%d,%d) Symbol: Real number %s\n",TokenNr,LineNr,
Token.String);
TokenNr = TokenNr+1;
break;
}
case 'E':
{
printf("Error condition: %s\n",
Token.String);
break;
}
}
} /* end while */
}


Thank you very much for your assistance.
--
comp.lang.c.moderated - moderation address: clcm@xxxxxxxxxxxx -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
.



Relevant Pages

  • Double Linked List
    ... 256 characters long identified in the input file F. Each identifier ... string is a string of characters representing the identifier itself. ... the file F which could not be classi ed in the lists NAMES, NUMBERS, ...
    (comp.lang.c)
  • Double Linked List start Help
    ... 256 characters long identified in the input file F. Each identifier ... identifier, length is an integer representing the length of the ... string is a string of characters representing the identifier itself. ...
    (comp.programming)
  • Re: Making a hash of things...
    ... require that you first collect the string and operate on the string ... while scanning the characters in the identifier. ... no matter how fancy your hashing function is, ...
    (alt.lang.asm)
  • Re: Making a hash of things...
    ... > require that you first collect the string and operate on the string ... > while scanning the characters in the identifier. ... have the length computed when you want to apply a hash. ...
    (alt.lang.asm)
  • Re: Formatting a string with leading zeroes.
    ... >If I have a number representing a number of minutes and I want to format it ... >as a string with two characters, with a leading 0 if the value is less than ...
    (microsoft.public.dotnet.framework)