Hello In bellow code I sorted 4 different ways in several txt file but I can not define more than arr[100000] otherwise windows close program automaticaly. I try to use malloc() but I couldn't also. Maybe m algorithm can be wrong. Do you have any idea
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>


int *selectionSort(int x[],int len){
    int j,k,temp;
    for (j=0; j<len; j++) {
        int min=x[j], ind=j;
        for (k=j+1; k<len; k++) {
            if(x[k]<min){
                min=x[k];
                ind=k;
            }
        }
        if(ind!=j) {
            temp=x[ind];
            x[ind]=x[j];
            x[j]=temp;
        }
    }
    return x;
}


int *bubbleSort(int x[],int len){
 int pass,k,temp;
    for (pass=0; pass<len-1; pass++) {
 for (k=0; k<(len-pass-1); k++) {
 if(x[k]>x[k+1]){
 temp=x[k];
 x[k]=x[k+1];
 x[k+1]=temp;


 }
  
 }
 
 }
 return x;
}


int *shellSort(int x[], int n){
    int temp,i,last,is_sorted;
    int jump=n/2;
    while(jump >=1){
        last= n-jump;
        is_sorted=0;
        while(!is_sorted){
            is_sorted=1;
            for(i=0; i<last; i++){
                if(x[i]>x[i+jump]){
                    temp=x[i];
                    x[i]=x[i+jump];
                    x[i+jump]=temp;
                    is_sorted=0;
                }
            }
        }
        jump=jump/2;
    }
    return x;
}




int *quicksort(int x[],int first,int last){
    int pivot,j,temp,i;
         if(first<last){
         pivot=first;
         i=first;
         j=last;


         while(i<j){
             while(x[i]<=x[pivot]&&i<last)
                 i++;
             while(x[j]>x[pivot])
                 j--;
             if(i<j){
                 temp=x[i];
                  x[i]=x[j];
                  x[j]=temp;
             }
         }


         temp=x[pivot];
         x[pivot]=x[j];
         x[j]=temp;
         quicksort(x,first,j-1);
         quicksort(x,j+1,last);
        
    }
    return x;
}


void printIntArr(int *arr, int len) {
    int i=0;
    for (i=0; i<len; i++){
        printf("%d ", arr[i]);
    }
    printf("\n");
}


void compare(int *arr1,int *arr2,int *arr3,int *arr4, int len) {
    int i=0;
    int check=0;
        for (i=0; i<len; i++){
        if (arr1[i] != arr2[i] && arr1[i] != arr4[i] && arr1[i] != arr3[i])        
                check++;
                break;
            
    }
    if (check !=0) printf("Sorted Arrays are not equal Difference Start at %i . variable in array",i);
    else printf("Sorted Arrays are equal");
}


int main(int argc, const char * argv[]){
    
    const char *fileName[10];
    FILE *fptr[10];         
    float timespent,begin,end;                
    int arr[100000];
    int arr1[100000];
    int arr2[100000];
    int arr3[100000];
    int arr4[100000];
    float quick[10];
    float bubble[10];
    float shell[10];
    float selection[10];
    int *selectionSortarr;
    int *quicksortarr;
    int *bubbleSortarr;
    int *shellSortarr;
    int i,x,z;
    for(i=1;i<argc;i++) {
        int j=0;
        fileName[i]=argv[i];
        fptr[i] = fopen(fileName[i], "r");
        if(fptr[i] == NULL){
            printf("Error!! Cannot open file: %s \n", fileName[i]);
            return EXIT_FAILURE;
        }
        else {
            printf("\nFile is opened successfully : %s \n", fileName[i]);
            while(!feof(fptr[i])) {   
                if(1 != fscanf(fptr[i], "%i" ,&arr[j])) {
                    break;
                }
                ++j;
            } 
            
            for (z = 0; z < j; z++) {
                
      arr1[z] = arr[z];
      arr2[z] = arr[z];
      arr3[z] = arr[z];
      arr4[z] = arr[z];
   }
        
            
            printf("%s 's number Of inputs:%i",fileName[i],j);
            printf("\n%s starts to sorting\n",fileName[i]);
            
        
            begin= clock();
            quicksortarr = quicksort(arr1,0,j-1);
            end= clock();
            timespent=(float)(end-begin)/CLOCKS_PER_SEC;
            quick[i]=timespent;


            
            begin= clock();
            shellSortarr = shellSort(arr2,j);
            end= clock();
            timespent=(float)(end-begin)/CLOCKS_PER_SEC;
            shell[i]=timespent;




            begin= clock();
            bubbleSortarr = bubbleSort(arr3,j);
            end= clock();
            timespent=(float)(end-begin)/CLOCKS_PER_SEC;
            bubble[i]=timespent;




            begin= clock();
            selectionSortarr = selectionSort(arr4,j);
            end= clock();
            timespent=(float)(end-begin)/CLOCKS_PER_SEC;
            selection[i]=timespent;
            printf("%s finished 4 different sorting\n",fileName[i]);
            
        
            compare(quicksortarr,shellSortarr,bubbleSortarr,selectionSortarr,j);
            printf("\n--------------------------------------------------------------------------------------------\n");
/*//            
printIntArr(arr, j);
    printIntArr(arr1, j);
    printIntArr(arr2, j);
    printIntArr(arr3, j);
    printIntArr(arr4, j);
    printIntArr(selectionSortarr, j);
    printIntArr(bubbleSortarr, j);
    printIntArr(shellSortarr, j);
    printIntArr(quicksortarr, j);
        compare(arr1,arr2,arr3,arr4,j);
*/
        }  
        
        
    }    
    printf("\nFilename");
    for(i=1;i<argc;i++) {
        printf("\t%s\t", fileName[i]);
    }


    printf("\nQuick Sort");
    for(i=1;i<argc;i++)
    {
       
       printf("\t%f\t", quick[i]);
        
    }
    printf("\nShell Sort");
    for(i=1;i<argc;i++)
    {
      
       printf("\t%f\t", shell[i]);
       


    }
    printf("\nBubble Sort");
    for(i=1;i<argc;i++)
    {
      
       printf("\t%f\t", bubble[i]);
       


    }
    printf("\nSelection Short");
    for(i=1;i<argc;i++)
    {
       
       printf("\t%f\t", selection[i]);
       


    }
    printf("\n");
printf("\n--------------------------------------------------------------------------------------------\n");






    for(i=1;i<argc;i++){
        
         fclose(fptr[i]);
         
         printf("%s is closed\n",fileName[i]);
        
    }
    return 0;    
}