I seem to get a line 19: warning: improper pointer/integer combination: arg #1, when I run this. I don't know why.
Code:
#include<stdio.h>
#include<stdlib.h>
#define ARRAY 500
int getRandA(int min, int max);
void exchangeSmallest(int list[], int first, int last);
void selectionSort(int list[], int last);
int main(void)
{
int i;
int j;
int first = 1;
int last = 500;
int list;
for (i = 0; i < ARRAY; i++)
{
j = getRandA(1, 1000);
selectionSort(j, last);
}
return(0);
}
int getRandA(int min, int max)
{
static int I = 0;
int rn;
if (I == 0)
{
srand(time(NULL));
I = 1;
}
rn = (rand() % (max - min +1)+ min);
return(rn);
}
void selectionSort(int list[], int last)
{
int current;
for(current = 0; current < last; current++)
{
exchangeSmallest(list,current,last);
}
return;
}
void exchangeSmallest(int list[], int current, int last)
{
int walker;
int smallest;
int tempData;
smallest = current;
for(walker = current +1; walker <= last; walker++)
{
if (list[walker] < list[smallest])
{
smallest = walker;
}
}
tempData = list[current];
list[current] = list[smallest];
list[smallest] = tempData;
return;
}