HOW do I malloc or new an array of complex numbers in GNU C++ code ?
MALLOC does not work, how do I use MALLOC correctly or NEW ?
I made a struct called complex (for a complex number with realp and imagp)
And I want to make an array of 128 locations (where each location includes a
realp and imagp)
Struct complex
{
Float realp;
Float imagp;
}
// tdin is a pointer to an array of complex numbers
complex* tdin;
// form the array with MALLOC or whatever works in GNU C++
tdin = (complex*) malloc ( 128 * sizeof (complex) );
then I can print the contents of the array with
for (int k; k<128; k++)
{ cout << tdin[k].realp << " and " << tdin[k].imagp << "endl";