ITPub博客

首页 > 应用开发 > > 排序,问什么要对数组长度减一呢

排序,问什么要对数组长度减一呢

作者:ou_159 时间:2019-09-26 10:29:11 0 删除 编辑

inta[]={49,38,65,97,76,13,27,49,78,34,12,64,5,4,62,99,98,54,56,17,18,23,34,15,35,25,53,51};  

    inttemp=0;  

    for(inti=0;i<a.length-1;i++){  

        for(intj=0;j<a.length-1-i;j++){  

        if(a[j]>a[j+1]){  

            temp=a[j];  

            a[j]=a[j+1];  

            a[j+1]=temp;  

        }  

        }

length减一什么意思呢

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1192/viewspace-3127293/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-15

  • 博文量
    117
  • 访问量
    1300