C: Two Different Arrays Pointing to the Same Struct
<p>I am working on a problem where I have a "master array" of pointers to a <code>typedef struct programs</code>.  For each item/structure that I create, I allocate memory to a <code>programs* temp</code> variable and store it into an array <code>programs* master_array[x]</code>.  </p>

<p>However, my problem requires me to handle errors in the <code>master_array</code> where if a <code>program</code> goes into a "blocked" state, then I have to manage that(those) process(es) separately.  </p>

<p>I want to create a second array called <code>programs* blocked_array[y]</code> and store programs that are blocked in there.  In this case, I can have two arrays pointing to the same <code>program</code>.  However, when I am finished with handling a <code>program</code> in blocked, how can I deallocate it/dereference the <code>blocked_array[y]</code>'s pointer to that <code>program</code> without impacting the <code>master_array[x]</code>'s pointer?  </p>

<p>Do I create an empty <code>program temp</code>, not allocate memory to this <code>temp</code> program and make the <code>blocked_array[y]</code> point to that <code>temp</code> program to effectively, empty out <code>blocked_array</code>?  </p>

<p>Would this create some sort of unintended consequence or does doing this stop the blocked array from pointing to it while preserving the <code>master_array[x]</code>'s pointer? Any thoughts would help, thanks. </p>