Your li
code has a pointer to an intList
. This pointer is not initialized to indicate anything, so accessing li.value
pointless (and erroneous).
The response fabrizioM creates a stack (not a pointer to one) on the stack, so memory is reserved for li.value
.
If you want to create an intList
with the actual data (which, as I understand it, you intend to be similar to the structure of linked lists), and if you want you to be able to return this intList
from functions, etc., you will have to isolate your structures intList
in a bunch and create there a complete list of links. Cython allows you to easily call malloc
(and free
).
lothario
source share