【发布时间】:2016-04-16 12:42:01
【问题描述】:
C 代码
void myfunction(double complex *x,int i1,int i2,int NN)
{
double complex *temp0;
double complex *temp1;
temp1=x[NN*i1+i2];
x[NN*i1+i2]=temp0;
}
错误
_fgt.c:381:12: error: incompatible types when assigning to type ‘__complex__ double *’ from type ‘complex double’
temp1=x[NN*i1+i2];
^
_fgt.c:382:18: error: incompatible types when assigning to type ‘complex double’ from type ‘__complex__ double *’
x[NN*i1+i2]=temp0;
^
问题
我以错误的方式使用指针,但我不知道如何修复代码。我正在尝试交换指针“x”指向的二维数组中的值,但是在交换期间保存值的临时指针“temp0”和“temp 1”与指向二维数组“x”的指针类型不兼容.我该怎么办?
【问题讨论】:
标签: python c arrays pointers types