0

For a vector pointer, is there a cleaner way to assign a value to an element in the vector through its pointer. For example;

vector<int> *num = new vector<int>(10,0); //gives {0,0,0,0,0,0,0,0,0,0} num->operator[](2) = 5; //gives {0,0,5,0,0,0,0,0,0,0}. IS HORRIBLE CODE! HELP

Theko Lekena
  • 225
  • 2
  • 10

0 Answers0