umm... yuck.
Code:
#include <iostream>
int main()
{
/*
* These are garbage data to fill the array
*/
int a=1;
int b=2;
int c=3;
int d=4;
/*
* This is the size of the array... put this in an I/O
* statement/response if you wish
*/
int x=2;
int y=2;
/*
* create an array of pointers to pointers, then point each pointer
* to a pointer to a new pointer
*/
int**arr=new int*[x];
for(int i=0;i<x;i++)
{
arr[i]=new int[y];
}
/*
* fill the array with the garbage data
*/
arr[0][0]=a;
arr[0][1]=b;
arr[1][0]=c;
arr[1][1]=d;
/*
* output the array
*/
for(int o=0;o<2;o++)
{
for(int i=0;i<2;i++)
{
std::cout<<arr[o][i]<<std::endl;
}
}
/*
* free up the memory (I was too lazy, but this CAN NOT be skipped)
*/
return 0;
}
oh yeah... dont' forget to free up the memory too
it's been a while since I've touched code, so forgive any retartedness in there