< [04] >

Object-Oriented Solution: Vectors

vector<int> A(10) ; // array of 10 int, init value 0 vector<int> A(10,5) ; // array of 10 int, init value 5 vector<float> B ; // empty array of type float A[0] = 17 ; // first item of array A[9] = 18 ; // last item of the array A.at(i) ; // ith item with range check A.push_back(4) ; // add 11th item vector<int> C ; // another array of int C = A ; // copy item by item