int input,n,i;
scanf("%d%d",&input,&n);
double a,b;
double complex arr[n];
for (i = 0; i < n; ++i)
{
scanf("%lf%lf",&a,&b);
creal(arr[i])=a;
cimag(arr[i])=b;
}
错误:需要左值作为赋值的左操作数在此处输入代码
真实(arr[i])=a;
为什么我不能接受复数数组的输入
最佳答案
根据6.2.5p13 ,你可以做(未经测试!)
double complex a[42];
double tmp[2];
tmp[0] = 3.14159;
tmp[1] = -2.71828;
memmove(a + 3, tmp, sizeof tmp); // a[3] = 3.14159 - 2.71828i
关于c - 如何在C中扫描复数数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44342739/