title: Bubble Sort Algorithm in C
body: <p>The program I"m trying to finish is a program using the bubble sort algorithm.  I am not sure what is the problem or in which function the problem is in.  The problem is the program does not sort the array in properly.  (It also must be arranged in ascending order).</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "simpio.h"
  
  void getArray (int arr[], int size);
  void sortArray (int arr[], int size);
  void swap (int arr[], int num, int number);
  void dispArray (int arr[], int size);
  bool checkBigger (int arr[], int num, int number);
  
  main()
  {
            int size;
  
            printf("Enter number of elements: ");
            size=GetInteger();
  
            int arr[size];
            getArray(arr, size);
            sortArray(arr, size);
            dispArray(arr, size);
  
            getchar();
  }
  
  void getArray (int arr[], int size)
  {
            int num;    
  
            printf("Please enter the value of the elements: \n");
            for(num=0; num&lt;size; num++)
            {
                       arr[num]=GetInteger();           
            }    
  }
  
  void sortArray (int arr[], int size)
  {
            int num, number, d;
  
            for(num=0;num&lt;size-1;num++)
            {
                for(d=0; d&lt;size-num-1; d++)
                {
                       number=num+1;                
                       checkBigger(arr, num, number);              
                }
            }
  }
  
  void swap (int arr[], int num, int number)
  {
            int tem;
  
            tem=arr[num];
            arr[num]=arr[number];
            arr[number]=tem;
  }
  
  void dispArray (int arr[], int size)
  {
            int num;
  
            printf("The sorted list is:\n");
            for(num=0; num&lt;size; num++)
            {
                        printf("%d\t", arr[num]);         
            }     
  }
  
  bool checkBigger (int arr[], int num, int number)
  {     
            if(arr[num]&gt;arr[number])
            {
                        swap(arr, num, number);                     
            }     
  }
  </code></pre>
  
  <p>Thank you very much.</p>