I have a table that I'm implementing with data structures. An important block of my code looks like this(h is a data structure, table is a table that stores other structures):
(h->table[hash(key, h->size)]
While my code is running, some table[i]'s will be initialized, and some aren't. Whenever I test my code on a table[i] that hasn't been initialized yet, I get a valgrind error which basically says I can't work with an uninitialized array.
My question is, how would I check to see if a certain h->table[i] is initialized or not?
You can't. To fix the problem, always initialize the struct before using it (even if all the initialization does is set the struct to a known "blank"/"not populated" state).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With