C:函数的返回矩阵

C:函数的返回矩阵,c,C,我试图在DEVC++v5.5.2中运行以下代码 以下错误“从不兼容指针类型返回”显示在属于头文件的“return arr”行中。另一个错误是“当从主程序的“result[0][j]=CircularShift(arr);”行中的“double complex*”类型分配给“double complex”类型时,类型不兼容” 请帮我解决这个问题 先谢谢你 main.c代码 enter code here #include<stdio.h> #include<conio.h>

我试图在DEVC++v5.5.2中运行以下代码 以下错误“从不兼容指针类型返回”显示在属于头文件的“return arr”行中。另一个错误是“当从主程序的“result[0][j]=CircularShift(arr);”行中的“double complex*”类型分配给“double complex”类型时,类型不兼容”

请帮我解决这个问题

先谢谢你

main.c代码

enter code here
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include"complex.h"
#include"shiftcheck.h"
#define SIZE 6
double complex *CircularShift(double complex arr[1][SIZE]);
void display(double complex arr[1][SIZE]);
int main()
{
int no,i,j;
    double complex (*result)[839],*result1;
    double complex arr[1][SIZE]={2,3,4,1,8,9,};
    printf("\nHow many times do you want the array to perform circular shifting?\n");
    scanf("%d",&no);

     for(j=0;j<no;j++)
    result[0][j] = CircularShift(arr);
在此处输入代码
#包括
#包括
#包括
#包括“complex.h”
#包括“shiftcheck.h”
#定义尺寸6
双复数*循环移位(双复数arr[1][SIZE]);
虚空显示(双复arr[1][SIZE]);
int main()
{
int no,i,j;
双复合物(*结果)[839],*结果1;
双复数arr[1][SIZE]={2,3,4,1,8,9,};
printf(“\n您希望数组执行多少次循环移位?\n”);
scanf(“%d”和“否”);
对于(j=0;j)“从类型“双复数”分配给类型“双复数”时不兼容的类型”*/

for(i=0;i0;i--)//将每个值移到下一个值,以便可以在开始处创建孔
arr[0][i]=arr[0][i-1];//移动值,索引0不变
arr[0][0]=temp[0][0];
//显示(arr);
return arr;/*此行中的错误是“从不兼容的指针类型返回”*/
}
Put
#在您的
complex.h
文件中包含
防护(因此只包含一次):

\ifndef COMPLEX\u H
#定义复数
#恩迪夫

然后删除
main.c
中的函数声明;您已经在
shiftcheck.h

中定义了它们。您忘记了包含错误注释:。如果要在多个文件中包含该头,则
循环移位
函数的定义将有多个实例,编译器将n不明确。您应该只在
.h
文件中创建函数原型,然后在
.c
文件中实现它们。
结果[0][j]
不是指针,而是
循环移位(arr);
返回指针。不需要返回值,因为它们会改变数组的内容。在上面,你会发现我用函数为C(gcc C11/C99)编写的一个程序,该程序以任何可能的方式分配和操作矩阵。也许它对你有用。。。
for(i=0;i<SIZE;i++)
{
    printf("%.2f+%.2fi\t",creal(result[0][i]),cimag(result[0][i]));

}
printf("\n");
getch();
return 0;
}
#include<stdio.h>
#include<conio.h>
#include"complex.h"
#define SIZE 6
void display(double complex arr[1][SIZE]);
double complex *CircularShift(double complex arr[1][SIZE])
{
    double complex temp[1][1];
temp[0][0] = arr[0][SIZE-1];
int i;//put the last element in the temp variable
    for(i=SIZE-1;i>0;i--)//shift each value to the next value so that a hole can be          created in the beginning
    arr[0][i]=arr[0][i-1];//shift the values,index 0 is not changed 
    arr[0][0]=temp[0][0];
    //display(arr);
    return arr;/* the error in this line is "return from incompatible pointer type"*/
}
#ifndef COMPLEX_H
#define COMPLEX_H
<insert complex.h stuff here>
#endif