Dynamic map creation or array
i need a help for create dynamic array or map. for example
CString *a1;
CString *a2;
CString *a3;
it minimized to using for loop.
for (int i=1;i<=3;i++)
{
CString s="a"+"itoa(i)"
CString *s;
}
something like this. its same as map concept
1 2 3
|
CString *a1;
CString *a2;
CString *a3;
|
This is already a bad idea. If you find yourself putting numbers after your var names, you're probably doing something wrong.
Any reason you can't use an array?
1 2 3 4 5 6
|
CString* a[3];
for(int i = 0; i < 3; ++i)
{
a[i] = /*whatever*/
}
|
Note that the loop should start at 0 and stop BEFORE 3
Topic archived. No new replies allowed.