New style (c to c++)
Solved
General and Desktop
-
Hi Guys,
How to correct this to the new style?
int i, n = (int)strtol(argv[1], nullptr, 10); // here n = n/2; double s = strtod(argv[2], nullptr); double f = strtod(argv[3], nullptr); double a = tan(M_PI*f/s); double a2 = a*a; double r; double *A = (double *)malloc(n*sizeof(double)); //here double *d1 = (double *)malloc(n*sizeof(double)); //here double *d2 = (double *)malloc(n*sizeof(double)); //here double *w0 = (double *)calloc(n, sizeof(double)); //here
Cheers
-
What do you mean with 'new style'? Do you mean using c++ (c++11/14/17) or Qt functions instead?
-
@pedromenezes said in New style:
int i, n = (int)strtol(argv[1], nullptr, 10); // here
Use
QString::toInt()
orQByteArray::toInt()
double *A = (double *)malloc(n*sizeof(double)); //here double *d1 = (double *)malloc(n*sizeof(double)); //here double *d2 = (double *)malloc(n*sizeof(double)); //here double *w0 = (double *)calloc(n, sizeof(double)); //here
Use
QVector<double>
orstd::vector<double>
-
@Christian-Ehrlicher Sorry, I mean c to c++.