int rowIsValid(int *row, int size){ int i, c=0; int *alreadyThere = fillAry(-1, size); for(i=0; i<size; i++){ if (inary(alreadyThere, size, row[i])) return 0; else if(row[i] > 0){ alreadyThere[c] = row[i]; c++; } } return 1; }
// Execution begins here int main() { // seed rand numbers unsigned seed = time(0); srand( seed ); // Declare Variables int *ip; int i_size, i_perLn; i_size=i_perLn=0; // Prompt the user for the input printf("Enter the size of an array: "); scanf("%d",&i_size); printf("Display how many numbers per line: "); scanf("%d", &i_perLn); // Allocate memory ip = (int *)malloc( sizeof(int)*i_size ); // fill array with random values fillAry( ip, i_size ); // Display the array printf("%s\n", "Before Sorted"); print( ip, i_size, i_perLn ); // sorts the array selSrt( ip, i_size ); // Display the array printf("%s\n", "After Sorted"); print( ip, i_size, i_perLn ); // Deallocate the memory free(ip); return 0; }