struct Array{ // length of array public: int length; // pointer to int array public: int *pData; // allocate array public: bool allocate(int size); // constructor public: Array(int size){ allocate(size); } // default constructor public: Array(){ length = 0; pData = 0; } public: ~Array(){ if(pData) delete []pData; } };
Array array(10000); for(int i = 0;i < array.length;i++) array.pData[i] = i*2;
Array array(10000); int l = array.length; int *pData = array.pData; for(int i = 0;i < l;i++) pData[i] = i*2;
public:
class
struct
std::vector
std::generate()
std::unique_ptr
Array array(10000); int l = array.length; int *pData = array.pData; for(int i = 0;i < l;i++) pData++ = i*2;
pData++
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)