//*************************************************************** // Code Snippet #1 //*************************************************************** void expand (int **hArray, int size, int newSize) { int *pNewArray = (int *) malloc (newSize * sizeof (int)); ... *hArray = pNewArray; } int main () { int *pArray; FILE *pFile; pFile = fopen ("data/numbers.txt","r"); fscanf (pFile,"%d", &size); pArray = (int *) malloc (sizeof (int) * size ); ... expand (&pArray, size, 100); //*************************************************************** // Code Snippet #2 //*************************************************************** typedef struct Node *NodePtr; typedef struct Node { char data; NodePtr psNext; } Node; void qCreate (NodePtr *hsQueue) { *hsQueue = NULL: } int main () { NodePtr psQueue; ... qCreate (&psQueue); //*************************************************************** // Code Snippet #3 //*************************************************************** static void printQueue (PriorityQueue sThePQ) { // Right now assumes an int priority of 4 bytes and an // int data of 4 bytes // Instead of dynamically allocating memory for pqData and // freeing later, what is another solution? void *pqData = malloc (8); int i; // A copy of sThePQ is made so original PQ is not changed // What does this mean? lstFirst (&(sThePQ.sTheList), pqData, 8); ... free (pqData); }