gpt4 book ai didi

c - 传递函数初学者

转载 作者:行者123 更新时间:2023-11-30 17:44:41 25 4
gpt4 key购买 nike

作为即将到来的周二我实验室测试的一部分,我们需要能够做这道题,否则我们将无法进行真正的考试!

这是代码:

 * This program finds the range between highest and lowest value of a 2-D array */

#include <stdio.h>

#define NROW 3
#define NCOL 3

int main(void)
{
/* declare needed variables or constants, e.g. */

int ar[NROW][NCOL];
int number;
int rows, columns;

/* prompt for the user to enter nine positive integers to be stored into the array */
for ( rows = 0 ; rows < 3 ; rows++ )
{
for ( columns = 0 ; columns < 3 ; columns++ )
{
printf("Please enter 9 numbers " );

scanf("%d", &number);ar[NROW][NCOL]

/*store the number temporarily*/
number = dispArray( ar[NROW][NCOL] )
}
}


/* call the disp_arr(...) function */
dispArray()

/* call the highest(...) function */


/* call the lowest(...) function */


/* display the range between highest and lowest number


/* Return to the operating system */


}
void dispArray( a[][] )
int rows, columns, a[][];

for ( rows = 0 ; rows < 3 ; rows++ )
{
for ( columns = 0 ; columns < 3 ; columns ++ )
{
printf( "%d\t", a[][] );
}
printf("\n");
}

return a[][];

/* Write a function where a[][] is the 2-D array
Print the entire array to the screen. */

目前我只需要知道如何将数组打印到屏幕上。我的函数以及我在 main 中调用它的方式显然是错误的。

我真的不擅长函数,尤其是在传递参数方面......我也不知道它是什么。

如有任何帮助,我们将不胜感激!谢谢!山姆

最佳答案

您需要进行这些更改

/* call the disp_arr(...) function */
dispArray(ar)

void dispArray(int a[][] )

然后,函数 dispArray 需要在其周围有 {},紧接在 void dispArray(int a[ ][])

关于c - 传递函数初学者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19888701/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com