I'm working on a project where I'm implementing a binary heap in C. I'm given Python code for this task, and I essentially need to "translate" the Python to C. I'm having some trouble dealing with translating "self" in Python to the equivalent in C.
Here's the Python code for initializing a binary heap in Python:
def __init__(self, items=None):
self.heap = [None]
if items is None:
self.heap_size = 0
else:
self.heap += items
self.heap_size = len(items)
self._build_heap() # this a call to another method
I'm pretty sure I need to define a struct BinaryHeap and fill in this information. How would I say something like "self.heap = [None]" or "self.heap_size = 0" in C? Note: I'm fairly new to C, haha.