Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

arrays in java

Name: Anonymous 2007-01-16 10:27

can someone tell me how to copy a 2 dimensional array to a 1 dimensional one? Ie.
array:
{2, 3, 5}
{4, 7, 9}
should become {2, 3, 5, 4, 7, 9}

Name: Anonymous 2007-01-18 4:08

>>16
Yes it has, though it still sucks


TYPE **a = malloc(WIDTH * sizeof(TYPE *));
for (int i = 0; i < WIDTH; i++) {
    a[i] = malloc(HEIGHT * sizeof(TYPE));
}


a is now a dynamic 2D array of TYPE


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List