Software Archive
Read-only legacy content
17060 Discussions

Array Notation for Non-static Memory

danprice
Débutant
1 734 Visites
Can Cilk's array notation be used with arrays that have been allocated dynamically with malloc or new (or any arbitrary pointer)? All of the examples show usage based off of a static array.
0 Compliments
1 Répondre
JD_Patel
Employé
1 734 Visites
yes, you can use array notation on dynamically allocated array... for example:

double* time = new double[NUM_OPTIONS];
time[0:NUM_OPTIONS] = 1.1;

- J.D. Patel
0 Compliments
Répondre