Hi I'm trying to intialize a struct for my cache simulator.
The problem is one of the elements I need to initialize is another structure called cache_line which is a linked list and I wanna initialize the pointers to head and last.
I thought it would do it like
Code:
cache wk_cache = {
my_cache.LRU_head = (Pcache_line*)malloc(sizeof(Pcache_line)*my_cache.n_sets);
my_cache.LRU_tail = my_cache.LRU_head;
};
Does that look right to anyone? Or am I way off...I haven't used a struct within a struct in awhile