Hi....I need to convert a 1D array into a 2D array of numbers....can anyone help me out with this?
the problem goes like this...

I have a string of numbers say..

0.123762
0.346515
.
.
.
.
.
to a total of 275.

i need to group them in the form of 11*25 2D array.

There are a few ways to do this. For one, let us define i as any index of the 1D array. The corresponding row of this element is

r = i / 25;

The column is

c = i % 25;

Alternatively (would likely be faster too), have three counters: r, c, and i. r would iterate (for loops) through 0 to 11, c through 0 to 25 (not inclusive). i would start at zero. The assignment would go like:

array2D[r][c] = array1D[i++];

oh...yea...ill try with this...thank u...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.