#include<stdio.h>
void selsort(int a[],int s)
{
int min,temp,i,j;
for(i = 0; i < s ; i++)
{
min = 0;
for(j = i+1 ; j < s; j++)
{
if(min > a[j])
{
min = j;
}
}
temp = a[i];
a[i] = a[min];
a[min] = temp;
for (j=0;j<s;j++)
{
printf("%d",a[i]);
}
printf("\n");
}
}
main()
{
int i,a[5];
int size = 5;
printf("Enter elements of the array");
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
}
selsort(a[5],size);
}
错误如下:
selsort.c:35:2: warning: passing argument 1 of ‘selsort’ makes pointer from integer without a cast [enabled by default]
selsort.c:2:1: note: expected ‘int *’ but argument is of type ‘int’
将来如何避免此问题的任何提示都将非常有帮助