Link to home
Start Free TrialLog in
Avatar of crazyMonkey
crazyMonkey

asked on

typedef PtrToNode List; program defined List implementation

error C2146: syntax error : missing ';' before identifier 'List'

typedef struct Node *PtrNode;
typedef PtrToNode List; //my error is in this part
typedef PtrToNode Position;

struct Node
{
     ElementType Element;
     Position Next;
};

//function declarations
List MakeEmpty(List L);
int IsEmpty(List L);
int IsLast(Position P, List L);
Position Find( ElementType X, List L);
void Delete(ElementType X, List L);
Position FindPrevious(ElementType X, List L);
void Insert(ElementType X, List L, Position P);
void DeleteList(List L);
Position Header(List L);
Position First(List L);
Position Advance(Position P);
ElementType Retrieve(Position P);
Avatar of efn
efn

The compiler doesn't know what PtrToNode is.

I think you want the first typedef to define "PtrToNode", not "PtrNode".
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: mayankeagle

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
With all due respect, I think my answer was better.

From the information available, crazyMonkey's problem was just defining PtrNode and then trying to refer to it with the different name PtrToNode.

With that correction, the design is OK and does not need the changes mayankeagle suggested.

--efn
Sorry efn, I know your comment is correct,
but I felt that with your comment crazyMonkey would not have been able to solve his problem.
I think mayankeagle's comment summaryses all the modifications needed.

Anyway, its just my opinion and my recommendation is not final as the moderator will check it out before closing it.