/*
 ============================================================================
 Name        : ArraysAndStructures.c
 Author      : Matt Boutell, David Mutchler and YOUR-NAME-HERE
 Description : An exercise to introduce structures and dynamic arrays.
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

typedef struct {
	int key;
	float* data; 	// Pretend that the data was bigger and more meaningful,
					// thus justifying using a pointer to the data here.
} KeyDataPair;

getArraySizeFromUser();			// TODO Student: fix args and return type.
constructArray();				// TODO Student: fix args and return type.
fillArrayWithRandomNumbers();	// TODO Student: fix args and return type.
selectionSort();				// TODO Student: fix args and return type.
printArrayKeys();				// TODO Student: fix args and return type.
destructArray();				// TODO Student: fix args and return type.

int main(void) {
	// Declare a dynamic array, along with other variables as needed.

	while (1) { // Run until user enters a negative number for the array size.

		// Ask the user for the size of the array and return the response,
		// storing it for further use.
		getArraySizeFromUser();		// TODO Student: fix args and/or returned value.

		// Return EXIT_SUCCESS if returned value from getArraySizeFromUser
		// is negative, otherwise just continue the loop.

	// TODO Student: write code here per above comment.

		// Construct the array with the requested size
		// and return a pointer to the allocated space.
		// Students: What should you do with the returned result?
		constructArray();	// TODO Student: fix args and/or returned value.

		// Fill the array with random numbers between 0 and 100.
		fillArrayWithRandomNumbers();	// TODO Student: fix args and/or returned value.

		// Sort the array.
		selectionSort();		// TODO Student: fix args and/or returned value.

		// Print the keys of the array (now be in ascending order)
		// all on the same line.
		printArrayKeys();		// TODO Student: fix args and/or returned value.

		// Deallocate the memory allocated to the array.
		destructArray();		// TODO Student: fix args and/or returned value.
	}
}

// Asks the user for the size of the array and returns the response.
// Does NOT do any error-checking for valid input.
getArraySizeFromUser() {		// TODO Student: fix args and return type.
	// TODO Student: implement this function per above comment.
}

// Constructs an array with the requested size
// and returns a pointer to the allocated space.
constructArray() {	// TODO Student: fix args and return type.
	// TODO Student: implement this function per above comment.
}

// Fill the array with random numbers between 0 and 100.
fillArrayWithRandomNumbers() {	// TODO Student: fix args and return type.
	// TODO Student: implement this function per above comment.
}

// Given an array of int's and the array's size, sort the array.
selectionSort() {	// TODO Student: fix args and return type.
	// TODO Student: implement this function per above comment.
}

// Print the keys of the array (now be in ascending order)
// all on the same line.
printArrayKeys() {	// TODO Student: fix args and return type.
	// TODO Student: implement this function per above comment.
}

// Deallocate memory that was allocated for this array.
destructArray() {	// TODO Student: fix args and return type.
	// TODO Student: implement this function per above comment.
}