Double Linked List Help
- From: "Little" <cookiecandyred@xxxxxxxxx>
- Date: 30 Jan 2006 17:21:52 GMT
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.
.
- Prev by Date: Re: make editor using C
- Next by Date: Re: Globals.
- Previous by thread: Callback Function
- Next by thread: I got the error message "Invalid Indirectoin operator"......?
- Index(es):
Relevant Pages
|