标题:error: invalid use of array with unspecified bounds
只看楼主
屋顶
Rank: 1
等 级:新手上路
帖 子:174
专家分:7
注 册:2016-2-27
结帖率:92.86%
已结贴  问题点数:12 回复次数:2 
error: invalid use of array with unspecified bounds
#include<stdio.h>
void dayin(int *[],int);
void fanbei(int *[],int);
main()
{
    int a[3][5]={1,2,3,4,5,6,m7,8,9,1,2,3,4,5,6};
    dayin(a,3);
    fanbei(a,3);
    dayin(a,3);
    }
void dayin(int (*m)[],int n)
{
    int i,j;
    for(i=0;i<3;i++)
       for(j=0;j<5;j++)
           printf("%d",*(*(m+i)+j));
    }
这段代码的错误,
g++.exe  -x c++ -c E:\编程\c文件\rrrr -o E:\编程\c文件\rrrr.o  -Wall -fpermissive  -Wno-sign-compare -g
E:\编程\c文件\rrrr:5: warning: ISO C++ forbids declaration of `main' with no type
E:\编程\c文件\rrrr: In function `int main()':
E:\编程\c文件\rrrr:6: error: `m7' undeclared (first use this function)
E:\编程\c文件\rrrr:6: error: (Each undeclared identifier is reported only once for each function it appears in.)
E:\编程\c文件\rrrr:7: error: cannot convert `int (*)[5]' to `int**' for argument `1' to `void dayin(int**, int)'
E:\编程\c文件\rrrr:8: error: cannot convert `int (*)[5]' to `int**' for argument `1' to `void fanbei(int**, int)'
E:\编程\c文件\rrrr:9: error: cannot convert `int (*)[5]' to `int**' for argument `1' to `void dayin(int**, int)'
E:\编程\c文件\rrrr: At global scope:
E:\编程\c文件\rrrr:12: error: parameter `m' includes pointer to array of unknown bound `int[]'
E:\编程\c文件\rrrr: In function `void dayin(int (*)[], int)':
E:\编程\c文件\rrrr:16: error: invalid use of array with unspecified bounds
Failure
谢谢了
搜索更多相关主题的帖子: invalid include warning 
2016-04-18 17:18
alice_usnet
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:370
专家分:2020
注 册:2016-3-7
得分:12 
程序代码:
#include<stdio.h>
void dayin(int (*)[5],int);
void fanbei(int (*)[5],int);
main()
{
    int a[3][5]={1,2,3,4,5,6,7,8,9,1,2,3,4,5,6};
    dayin(a,3);
    fanbei(a,3);
    dayin(a,3);
}
void dayin(int (*m)[5],int n)
{
    int i,j;
    for(i=0;i<3;i++)
       for(j=0;j<5;j++)
           printf("%d",*(*(m+i)+j));
}

未佩好剑,转身便已是江湖
2016-04-18 18:05
屋顶
Rank: 1
等 级:新手上路
帖 子:174
专家分:7
注 册:2016-2-27
得分:0 
回复 2楼 alice_usnet
谢谢了
2016-04-18 18:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-463793-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.216814 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved