【问题标题】:what is the prototype declaration for this code?这段代码的原型声明是什么?
【发布时间】:2014-09-25 09:06:15
【问题描述】:

我从 main 调用三个函数来打印数组

void display(int *q,int row,int col){
                                      //code
                                 }
void show(int(*q)[4],int row,int column){
                                       //code
                                    }
void print(int q[][4],int row,int column){
                                       //code
                                        }

我从 main() 调用这个 display()、print() 和 show():

int a[3][4]={1,2,3,4,5,6,7,8,9,0,1,2};
display(a,3,4);
show(a,3,4);
print(a,3,4);

这三个函数用三种不同的方式打印数组的元素 现在我想知道 display()、print() 和 show() 的原型声明是什么??

【问题讨论】:

  • void display(int *q,int row,int col); and void show(int(*q)[4],int row,int column); and void print(int q[][4],int row,int column);
  • display(a,3,4); --> 例如display(*a,3,4);

标签: c function argument-passing


【解决方案1】:
void display(int *q,int row,int col);
void show(int(*q)[4],int row,int column);
void print(int q[][4],int row,int column);

如果你把函数定义放在主函数之前,那么就不需要原型声明...

【讨论】:

    猜你喜欢
    • 2012-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-02
    • 1970-01-01
    • 1970-01-01
    • 2019-11-21
    相关资源
    最近更新 更多