Is there a "Heap-use after free" in my code here?

I have a struct in C which mimics a hashtable, except it is an array of linked lists. The length of the array is predetermined by the hash_length and is set to 2^hash_length. My function here is supposed to free all of the memory allocated by its respective ht_create function. By looping through the array… Read More Is there a "Heap-use after free" in my code here?

Need help understanding flaw in my efforts to free memory from created hashtable

I am studying C (self-study, not in an educational institution) and have been trying to build a hashtable data structure as part of my learning. Please refer to this hopefully reproducible example: #include <stdio.h> #include <stdlib.h> struct table_item { char *name; char gender; char *birthdate; char *address; }; struct list_node { struct table_item *data; struct… Read More Need help understanding flaw in my efforts to free memory from created hashtable

c# Class object – What is the best way to store/retrieve a multiple-value list?

I’m teaching myself how to use classes in c#. I have a ‘what’s the best way’ question I’m hoping someone with experience can give me guidance on. Say I have a class object for a ‘Teacher’. The class has members for the teacher’s name, grade level, pay rate, and so on. I’d also like to… Read More c# Class object – What is the best way to store/retrieve a multiple-value list?

Python if statement to skip dictionary key when creating a dictionary

My code looks like this: def createEventBody(name,description,attendees,location, eventColor = None): eventBody = { ‘Name’: name, #EventName ‘Color’: eventColor, ‘location’: location, ‘description’:description, ‘attendees’: [], } The thing is, I want to add some logic so that the key ‘Color’ is not included if eventColor = None. I was thinking something like this: def createEventBody(name,description,attendees,location, eventColor =… Read More Python if statement to skip dictionary key when creating a dictionary