How to properly add item to array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to properly add item to array?

currently I'm trying to add an item to an array using the vector module, but keep getting an error when I try to call the push_back function. could anyone assist? https://code.sololearn.com/c4DqmUIb4qrv/?ref=app

5th Sep 2017, 10:38 AM
X-1
X-1 - avatar
3 Answers
5th Sep 2017, 10:42 AM
Karl T.
Karl T. - avatar
+ 11
https://code.sololearn.com/cMrAo68R3qG8/?ref=app note: in this example the variable "value" is redundant. you can use x from the for loop
5th Sep 2017, 11:00 AM
jay
jay - avatar
+ 2
You can use Myaray.at(i); at is part of vector class obj to it anyways
5th Sep 2017, 11:59 AM
Pickle_Rick()
Pickle_Rick() - avatar