笑影vod 2021-10-18 22:38 采纳率: 71.4%
浏览 31
已结题

visual c++6.0 数组名做函数参数,代码没错,编译出错,求朋友们扫一眼


# include<stdio.h>
# include<stdbool.h>



   void sorter (age[])
{
    bool x;
    int i,j,k,maxer=age[0];
    for(i=0;i<=9++i)
    {
        for(j=i;j<=9;++j)
        {
            if(age[j]>maxer)
            {
                maxer=age[j];
                x=ture;

            }
            else  x=false;
        }
        if (x==ture)
        {
            k=maxer;
            array[i]=k;
        }


    }



}


int main ()

{

    void sorter (age[10]);

    int a[10];
    int i;
    for (i=0;i<=9;++i)
    {
        scanf("%d",&a[i]);
    }
    sorter(a);
    for(i=0;i>9;i++)
    {
        printf("%d",a[i]);
    }






    return 0;
}


例7—12.cpp
D:\C程序\例7—12.cpp(6) : error C2065: 'age' : undeclared identifier
D:\C程序\例7—12.cpp(6) : error C2059: syntax error : ']'
D:\C程序\例7—12.cpp(7) : error C2143: syntax error : missing ';' before '{'
D:\C程序\例7—12.cpp(7) : error C2447: missing function header (old-style formal list?)
D:\C程序\例7—12.cpp(40) : error C2109: subscript requires array or pointer type
D:\C程序\例7—12.cpp(40) : error C2182: 'sorter' : illegal use of type 'void'
D:\C程序\例7—12.cpp(48) : error C2064: term does not evaluate to a function
执行 cl.exe 时出错.

  • 写回答

1条回答 默认 最新

  • 赵4老师 2021-10-19 09:15
    关注

    void sorter (int age[])

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 10月27日
  • 已采纳回答 10月19日
  • 创建了问题 10月18日

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效