#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;
}
}
}
when I compile it in CodeBlocks, it gives:
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
and when I run the program, it just crashes.
Any clues?
-Walloption. You will discover a lot of things...