I’m working on an OpenGL/C++ program where I need to store coordinates as and when I plot them in my window. But since the number of points plotted is undefined, I cant fix up the size of the array. Is it possible to dynamically allocate space to an array? Can I use any other data structures to accomplish the same?
Share
Yes, use a
std::vectorinstead.Combined with
push_backyou can dynamically increase the number of elements.You can access the elements same as you would with an array: