Here are a few lines of C++ code I recently saw.
double a[p][p]; for(i=0;i<p;i++) { for(j=0;j<p;j++) { a[i][j] = m[i][j]; //m is sth we are given. } } dgeev_(&jobvl,&jobvr,&p,(double*)a,&lda,(double*)wr,(double*)wi,(double*)vl, &ldvl,(double*)vr,&ldvr,(double*)work,&lwork,&info); // sth else.. dgeev_ is a function and you can find its documentation here: http://www.netlib.org/clapack/old/double/dgeev.c
dgeev_ is declared in header in the following way, so we can use C function in C++ codes.
extern "C" { void dgeev_(char*, char*, int*, double*, int*, double*, double*, double*, int*, double*, int*, double*, int*, int*); } As we can see, a is static array, and dgeev_ need a variable of type doublereal * for the 4th parameter.
What does (double*)a do here?
ais two-dimensional. The cast is not only "necessary" to obtain a build; it is wrong.dgeev.c? C++ code is not written in files named.c. Furthermore, the project's own FAQ says that it is C code. So I'm not sure why you're claiming that it is C++.dgeev.cis C. But the snippets of codes I provided is C++. By declaring the C functionextern "C"(in the C++ code), so we can use C directly in C++. I think this may be important for this question.