我已经在某种程度上与此相关的其他线程四处寻找,但不知何故,我只是不明白它传递参数...警告:“从兼容的指针类型[默认启用]”
我想对我已评估过的一组值进行一些FFT,并编写该程序首先读取值并将其保存到大小为n
的数组中。
int main() {
// some variables and also a bit of code to read the 'messwerte.txt'
printf("Geben sie an wieviele Messwerte ausgelesen werden sollen: ");
scanf("%d", &n);
double werte[n]; //Array der "fertigen" Messwerte
in = fopen ("messwerte.txt","r");
double nul[n]; //Array von nullen
int logN = 14;
l=FFT(logN,&werte,&nul);
}
在同一个文件中我也做了FFT与此程序的帮助:
double FFT (int logN, double *real, double *im) //logN is base 2 log(N) {
// blabla FFT calculation
}
但是,我编译时总是出现此错误:
gcc FFT.c -lm
FFT.c: In function ‘main’:
FFT.c:94:2: warning: passing argument 2 of ‘FFT’ from incompatible pointer type [enabled by default]
FFT.c:4:8: note: expected ‘double *’ but argument is of type ‘double (*)[(unsigned int)(n)]’
FFT.c:94:2: warning: passing argument 3 of ‘FFT’ from incompatible pointer type [enabled by default]
FFT.c:4:8: note: expected ‘double *’ but argument is of type ‘double (*)[(unsigned int)(n)]’
由于这是我第一次编程,我真的不知道我的代码有什么问题。我将不得不为编译器设置更多的标志或类似的东西(因为我必须这样做-lm
的东西,否则它不会编译,并说pow没有找到或类似的东西)?
此外,我意识到在Windows或Linux计算机上编写时可能会有所不同,并且我正在使用Linux,Lubuntu 12.10 32位(如果它是操作系统的问题)。
*当你做了&werte你试图传递一个地址的地址*并非如此。 &werte会产生相同的地址,但是类型不同。 – cnicutar
对不起。不是一个地址的地址,我正在寻找二维数组中第一个元素的地址的正确措辞(正如你所看到的,它本身没什么意义)。尽管如此,我找到了正确的方法来将它放在你的答案中。 :d – varevarao