I'm using some dynamically allocated arrays of multiprecision variables (from the mpc-library) and wonder if it is necessary both to clear the variables and to delete the arrays to avoid memory leaks etc? In other words, is all the housekeeping in the snippet below necessary?
using namespace std;
#include <gmp.h>
#include <mpfr.h>
#include <mpc.h>
int main() {
int i;
mpc_t *mpcarray;
mpcarray=new mpc_t[3];
for(i=0;i<3;i++) mpc_init2(mpcarray[i], 64);
// Manipulations
for(i=0;i<3;i++) mpc_clear(mpcarray[i]);
delete [] mpcarray;
return 0;
}