Showing posts with the label Pointers

How to Work with 'Pointers' in Python

Pointers in Python is a memory location. It has three identities - Name, Value, and Location (Address). Python supports Pointers for writing C logic. For this purpose, you need the ctypes library. What is Pointer? 1. It has value 2. It has an address 3. It has Name Python Does not Has Pointer Datatype. If the Python does not has a Pointer data type, why it supports. The main reason is to deal with C- Interface.  The best example is sending an address instead of the actual value. How to Import ' ctypes ' in Python (Windows/Linux)? To work with C, in Python you need to import a  'ctypes ' library . Read here how to import 'ctypes' for windows and Linux. How to Use Pointers in Python? To pass a reference(address) to the C interface. To write C functions in Python. Once ctypes library present, then you can write C logic in Python. References How to use c types in Python from docs ?