I have an array that I want to be dynamic, that is, that can be resized according to the needs of the program. How can I resize the array and preserve its current values?
also you can use STL vectors what are compatible with much many C++ compillers than MFC.
#include<vector>
#include<algorithm>
using namespace std;
....
int x;
vector<int> vx;
vector<int>::iterator ivx;
vx.push_back(x);
vx.push_back(10);
vx.push_back(20);
x = vx[1];
ivx = find(vx.begin(),vx.end(),10);
if(ivx != vx.end) x = *ivf;
... Ion Filipski
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.