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.
>>> 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 >>>
ctypes/pointer
pointer