please help me

Home Forums C Programming please help me

Viewing 3 reply threads
  • Author
    Posts
    • #2211
      HildegaBarnett
      Participant

      there is something wrong with bubbleSort argument
      #include
      void bubbleSort(float arr[],int len)
      {
      int isSorted=0;
      do
      {
      float temp;

      int i;
      isSorted=1;
      –len;
      for(i=0;i if(arr>arr[i+1])
      {
      isSorted=0;
      temp=arr
      ;
      arr
      =arr[i+1];
      arr[i+1]=temp;
      }
      }while(!isSorted);
      }

      int main()
      {
      float r[]={10,9,8,7,6,5,4,3,2,1};
      int j=10,b;
      bubbleSort(r[j],j);
      for(b=0;b<10;b++)
      printf(“%4.2fn”,r);
      return 0;
      }

      can you help me? I am a rookie.thanks.

    • #3589
      HildegaBarnett
      Participant

      Ah,I can manage it myself. :P
      in main function,”bubbleSort(r[j],j)”,there is no subscript operator”[]”.just “bubbleSort(r,j)”.

    • #3590
      GWILouisaxwzkla
      Participant

      Heres a bubble sort I wrote awhile ago ( hope this helps ):

    • #3591
      HildegaBarnett
      Participant

      Thanks,dman!

Viewing 3 reply threads
  • You must be logged in to reply to this topic.