C:将数组作为参数传递给函数会导致垃圾,同时发送指针会正常工作

C:将数组作为参数传递给函数会导致垃圾,同时发送指针会正常工作,c,arrays,pointers,debugging,function-pointers,C,Arrays,Pointers,Debugging,Function Pointers,所以我有这个函数: int fillPricesTable(double* flightsPrices, int n, double* dollarRate) { int i = 0; while (*dollarRate <= 0) { scanf("%lf", dollarRate);

所以我有这个函数:

int fillPricesTable(double* flightsPrices,
                        int     n,
                        double* dollarRate) 
    {   
        int i = 0;
        while (*dollarRate <= 0) {
            scanf("%lf", dollarRate);
                if (*dollarRate <= 0) {
                errorDollar();
                }
        }
        while (scanf("%lf", flightsPrices+i)!=EOF) {
            if (*(flightsPrices+i) <= 0) {
                errorPrice(i - 1 / 6);
                return -1;
            }
                i++;
            }
        return (i / 6);

        }
那么这个函数就不起作用了

我还从visual studio收到以下警告:

Non-float passed as argument '2' when float is required in call to 'scanf' Actual type: 'double [6]'.

Help

FWIW,
double[][]==double**
,而不是
double*
。关于您的警告,
double[6]
是实际类型,但它需要类型
double*
。例如:
double d;扫描频率(“%lf”、&d)如何定义、初始化并将传递的内容传递给函数
fillPricesTable()
?请出示相关代码。我理解语法的问题,但我仍然不知道如何消除警告。如果FlightSprites是2d数组,我应该如何正确写入scanf(“%lf”,FlightSprites+I)?@JohnForkosh和@Mateen,
double[][
的形状或形式与
double**
int fillPricesTable(double flightsPrices[][DEST], int n, double* dollarRate);
Non-float passed as argument '2' when float is required in call to 'scanf' Actual type: 'double [6]'.