How to represent circular struct in python using ctypes?
A linked list can be represented in the following way in c
typedef struct LinkedList LinkedList;
typedef struct Node Node;
struct Node
{
int value;
Node* next;
};
struct LinkedList
{
Node* start;
int length;
};
How to represent the same struct in python using ctypes.
I tried the following
from ctypes import *
class Node(Structure):
_fields_ = [
("value", c_int),
("next", pointer(Node))
]
But the above gives the following error
NameError: name 'Node' is not defined