Question about linked list

Hi,
I try to make a Linked List in C (not ++).
My problem is that any entity in my list in different.
for example, my list is a shapes list:

Circle -> Rectangle - > Line - > Polygone -> NULL

As you can see any entity in the list is a different shape, how can i difine my list entity?
closed account (z05DSL3A)
You may want to look at a ‘generic linked list’, this is a linked list with a void* in the node for the data. By typecasting, you can use the linked list for any type. You may be able to get that to do what you want.

1
2
3
4
5
6
7
8
9
Node -> Circle
  |
Node -> Rectangle
  |
Node -> Line
  |
Node -> Polygone
  |
NULL

Last edited on
Topic archived. No new replies allowed.