// Program that uses an array of pointers to have each index reference // another index. Program finds the path taken from a starting index. // // Written by YOUR-NAME (YOUR-ZID), DD-MM-YYYY // #include #include #define MAX_SIZE 10 void print_pointer_path( int *pointers[MAX_SIZE], int indices[MAX_SIZE], int start ); // DO NOT CHANGE THIS MAIN FUNCTION int main(void) { int *pointers[MAX_SIZE]; int indices[MAX_SIZE]; int index; printf("Please enter which indices the pointer array will reference:\n"); int count = 0; while (count < MAX_SIZE && scanf("%d", &index) == 1) { pointers[count] = &indices[index]; count++; } printf("Please enter which indices the index array will reference:\n"); count = 0; while (count < MAX_SIZE && scanf("%d", &index) == 1) { indices[count] = index; count++; } int start; printf("What index will the path start at? "); scanf("%d", &start); print_pointer_path(pointers, indices, start); } // Prints the index-path from the given `start` index. Starts in the `pointers` // array and bounces between pointers->indices->pointers->indices... void print_pointer_path( int *pointers[MAX_SIZE], int indices[MAX_SIZE], int start ) { // TODO: Complete this function }