#include #include #include"quelist.h" int main(int argc, char **argv) { int i = 0; int j = 0; int size = 5; //size of the array being loaded, changes whole program to size 10, 20, 100, etc... int position = 0; //position of lowest value in the array int temp = 0; //temp variable for switching values around int lowval = 0; //lowest value in the array bounds int value[size]; //my array Queue *myque; //queue structure being used from a previous project, pulled with ehader file "quelist.h" myque = (Queue *) malloc (sizeof(Queue)); //malloc the queue myque -> head = myque -> tail = myque -> tmp = NULL; //initialize all parts to NULL so i know what they are doing and where they are if(argc < size+1) //if there isn't enough command-line arguments entered { for(i=0;i value[i+1]) { //if lowval is greater than the next value in the array lowval = value[i+1]; //lowvalue is now the next value in an attempt to find the lowest value position = i+1; //save the position of that low value } } if(lowval != value[j]) //if lowvalue isnt the first position of the array bounds { temp = value[j]; value[j] = lowval; value[position] = temp; //bring the low value to the front } enqueue(myque, lowval); //start loading that queue! j++; } printf("This array is now sorted via a selection sort"); for(i=0;i value)); //dequeue returns a node, so we need to point to its value printf("\n"); return 0; }