PyDocs

Nav

Generic Operating System Services

pointer

ctypes

function (source)
  • pointer(obj, /)
Create a new pointer instance, pointing to 'obj'.

The returned object is of the type POINTER(type(obj)). Note that if you
just want to pass a pointer to an object to a foreign function call, you
should use byref(obj) which is much faster.
1 Example
>>> c1 = cell()
>>> c1.name = b"foo"
>>> c2 = cell()
>>> c2.name = b"bar"
>>> c1.next = pointer(c2)
>>> c2.next = pointer(c1)
>>> p = c1
>>> for i in range(8):
...     print(p.name, end=" ")
...     p = p.next[0]
...
foo bar foo bar foo bar foo bar
>>>
from the Python docs
See Also
No see-alsos for ctypes/pointer
0 Notes
No notes for pointer