I am doing unit testing on my c++ code on VS code windows, however I am stuck with a simple issue. I am trying to print out the output of a test function and compare to something I have. The output is type double (*)[2] and for some reason it seems like I can't use printf("%4.21e\n", output);
I have the error:
format '%e' expects argument of type 'double', but argument 2 has type 'double (*)[2]'
The code is pretty long and messy, however all I am trying to do is printout: potSourcek_inertia in line 667 in testBed. Thank you!
This is working for me, although giving all zeros but at least it's printing out. Would you care explain what [0] and [1] mean next to the *potSoruceK_inertia?
The fftw_complex type holds a complex number as a 2-element array of doubles. [0] accesses the first element, the real part; [1] accesses the second, the imaginary part. potSourcek_inertia is a pointer to such an array, which is why we need the asterisk (and parens due to precedence) before the [0] and [1].