错误:从类型'complex double'分配类型'__complex__ double *'时出现不兼容的类型

时间:2016-01-12 02:16:56

标签: python c arrays pointers types

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;
                  ^

问题

我以错误的方式使用指针,但我不知道如何修复代码。我试图交换指针指向的2D数组中的值,然而我的临时指针' temp0'和'临时1'在交换期间保持值的类型与指向2D数组的指针不兼容' x'。我该怎么办?

1 个答案:

答案 0 :(得分:1)

一旦下标复杂的双指针var express = require('express'); var appRoutes = express.Router(); var passport = require('passport'); var localStrategy = require('passport-local').Strategy; var models = require('../models/db-index'); appRoutes.route('/sign-up/organization') .get(function(req, res){ models.User.find({ where: { user_id: req.user.email }, attributes: [ 'user_id', 'email' ] }).then(function(user){ res.render('pages/app/sign-up-organization.hbs',{ user: req.user }); }) }) .post(function(req, res, user){ models.Organization.create({ organizationName: req.body.organizationName, admin: req.body.admin, members: req.user.email }).then(function(organization){ console.log(organization); models.User.update({ annotationId: organization.organizationId },{ where: { user_id: req.user.user_id }}); res.redirect('/app'); }).catch(function(error){ res.send(error); console.log('Error at Post' + error); }) }); ,你就是取消引用你的指针并得到一个实际值,所以在这里x[NN*i1+i2]你要为双复指针指定一个双复数值。 .kaboom。

请改为尝试:

temp0 = x[NN*i1+i2];