1
Hi, I’m doing a Sort Selection program in c, but I’m having a hard time. How or where, and what I put in order for the user to type the array size as well as its elements.
I tried so:
#include <stdio.h>
int main(){
int num[];
int tam, l;
int i, j, min, aux;
printf("Digite o tamanho do array: ");
scanf("%d", tam);
printf("Digite o array: ");
scanf("%d", num[]);
for (i = 0; i < (tam-1); i++){
min = i;
for (j = (i+1); j < tam; j++) {
if(num[j] < num[min]) {
min = j;
}
}
if (i != min) {
aux = num[i];
num[i] = num[min];
num[min] = aux;
}
printf("\n");
}
}
But when you type something already closes the program, someone knows how to fix it?
Why you have to inform the array?
– user17270