I'm trying to run the following code in DEVC++ v5.5.2 The following error "return from incompatible pointer type" shows up in line "return arr" belonging to header file. Another error is "incompatible types when assigning to type 'double complex' from type 'double complex*" in the line that reads "result[0][j] = CircularShift(arr);" of the main program.
Please help me resolve this.
Thank you in advance
The main.c code
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);
/this error pops up when above line is executed ->"incompatible types when assigning to type 'double complex' from type 'double complex'*/
for(i=0;i<SIZE;i++)
{
printf("%.2f+%.2fi\t",creal(result[0][i]),cimag(result[0][i]));
}
printf("\n");
getch();
return 0;
}
the header file is as follows
#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"*/
}