Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String args [])
- {
- int a [] = new int [10];
- int b [] = new int [10];
- int c [] = new int [10];
- int d [] = new int [10];
- int e [] = new int [10];
- int f [] = new int [10];
- //instead of having 6 different arrays, why not just make 1 array?
- int g [] [] = new int[6][]; //allocate memory for 6 arrays.
- // above is still just an array of 6 arrays:
- // why not make one array, and index it as a 2d array:
- int h* = new int[10 * 6 /* width * height */];
- // access by:
- int test = h[y * width + x]; // x being column, y being row, both starting at 0
- // also, shame on everyone for not cleaning up after themselves :P
- delete [] h;
- delete [] g
- return;
- }
Add Comment
Please, Sign In to add comment