我正在尝试初始化一个包含复数双精度的 2D 动态数组。我无法弄清楚这个错误消息告诉我做什么,并且在任何地方都找不到它。
#include <complex.h>
...
int main( int argc, char *argv[] ) {
complex double **A;
FILE *inputFile;
int i;
double numRow, numCol;
inputFile = fopen( "input.txt", "r" );
fscanf( inputFile, "%lf %lf", &numRow, &numCol );
A = ((complex double)**)malloc( numRow * sizeof( (complex double)* ) );
for( i = 0; i < numCol ; i++ ) {
A[i] = ((complex double)*)malloc( NC * sizeof( (complex double) ) );
for( i = 0; i < m; ++i ) {
free( A[i] );
}
free( A );
我得到的错误来自调用 malloc 的两行。
gewhpp.c:58:26: error: expected expression before â)â token
gewhpp.c:60:29: error: expected expression before â)â token