0
#include <stdio.h>
#include <conio.h>
void sorter(int b, int a[]);
int main(void){
int i, j, arraySize;
int arrayNums[arraySize];
printf("Please enter how many numbers you wish to enter: ");
scanf("%d", &arraySize);
for(i =0; i<arraySize; i++)
{
printf("Enter Value No. %d: ", i+1);
scanf("\n%d", &arrayNums[i]);
}
for(i=0; i<arraySize; i++)
printf("%d", arrayNums[i]);
sorter(arraySize,arrayNums);
printf("after sorting");
for(i=0; i<arraySize; i++)
{
printf("\n%d", arrayNums[i]);
}
}
void sorter(int b, int a[]){
int i,j, swap;
for(i = 0; i<b; i++)
for(j=i; j<b; j++)
{
if(a[i]>a[j]){
swap= a[i];
a[i]=a[j];
a[j]=swap;
}
}
}
,當我在代碼塊編譯它,它給:使用功能排序數組中C,但計劃只是不運行
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
,當我運行程序,它只是崩潰。
任何線索?
什麼是你的輸入? – Downvoter
當你運行它時有沒有輸出? – Arc676
使用'-Wall'選項編譯它。你會發現很多東西... – LPs