help about error: lvalue required left operand assignment c
Hi all,
I am working with complex number and using fftw library ( FFTW Home Page ) to compute fft of some data. But when I am compiling my following simple piece of code , I am getting the above mentioned error.
Code:
#define re(c) ((c)[0]) ///< real part of a complex number as defined by fftw_complex in fftw
#define im(c) ((c)[1])
#include <fftw3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
unsigned int fs = 16367600;
double fif = 4.1304E6;
double range = fif;
double span = 10E3;
double fd_step = 500;
double Tint = 1;
unsigned int l,C1,D1;
int main()
{
C1 = ceil((double) fs * 1E-3);
D1 = ceil(span / fd_step) + 1;
SUM_SS = (fftw_complex *) fftw_malloc(sizeof(fftw_complex) * C1 * D1);
if (SUM_SS == NULL) {
fprintf(stderr, "Error allocationg memory fftw operations \n");
}
for (l = 0; l < C1 *D1; l++) {
re(SUM_SS[l]) = 0.0;
im(SUM_SS[l]) = 0.0;
}
}
fftw_malloc behaves like malloc except that it properly aligns the array when SIMD instructions (such as SSE and Altivec) are available. The data is an array of type fftw_complex, which is by default a double[2] composed of the real (in[i][0]) and imaginary (in[i][1]) parts of a complex number.
The error is reported on line re(SUM_SS[l]) = 0.0; and im(SUM_SS[l]) = 0.0; and reported error is
error: lvalue required as left operand of assignment
Please help me
Thanks