>>What i was wondering is it possible to dynamically create these array[][] varibles
Yes, of course.
Code:
int **array = new int*[rows];
for (int x = 0; x < rows; x++) {
array[x] = new int[cols];
}
This creates a simulated array of arrays using dynamic memory. To release the memory you perform the same operations in reverse using delete.
Code:
for (int x = 0; x < rows; x++) {
delete [] array[x];
}
delete [] array;
However, managing your own memory is error prone. A better soution is to use the standard vector container given to you by the standard C++ library.
Code:
#include <iostream>
#include <vector>
int main()
{
std::vector< std::vector<int> > v;
v.push_back(std::vector<int>(5, 10));
v.push_back(std::vector<int>(5, 20));
v.push_back(std::vector<int>(5, 30));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 5; y++) {
std::cout << v[x][y] << ' ';
}
std::cout << std::endl;
}
return 0;
}