473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Array columns

Is it possible to add columns to an array using dimenion of another array ? For example i have an array..

int[][] anArray = new int[100][20], Obviously.. it accepts 20 columns. What I want to do is to use another array to pass it into the columns for example,

int[] anArray2 = new int[somevalue] //somevalue is an input lets say 4. Then this array pass it to 20 columns, and create 4 columns for me, later I want ot use the remaining 16 columns to pass another value (same as above) and create me lets say 10 more columns.

Thank you
Apr 20 '07 #1
1 1342
JosAH
11,448 Expert 8TB
Is it possible to add columns to an array using dimenion of another array ? For example i have an array..

int[][] anArray = new int[100][20], Obviously.. it accepts 20 columns. What I want to do is to use another array to pass it into the columns for example,

int[] anArray2 = new int[somevalue] //somevalue is an input lets say 4. Then this array pass it to 20 columns, and create 4 columns for me, later I want ot use the remaining 16 columns to pass another value (same as above) and create me lets say 10 more columns.

Thank you
It certainly can be done but it involves a lot of 'mechanics' i.e. arrays can not
be resized so you have to allocate (new) another array, one larger than the
previous one and copy the content of the old array over to the other new array.

Then you have to replace the old array (a row in your two dimensional array)
by the new array.

I prefer ArrayLists for this sort of juggling.

kind regards,

Jos
Apr 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sam | last post by:
Hello all I have a two dimensional array (the dimensions are not known) that needs to be passed to fortran from c++, allocate the dimensions of the array in fortran code, do some filling up of...
5
by: mark4asp | last post by:
Suppose I wanted to create an array that was associative in 2 dimensions. The rows are associated with numbers. The columns with words. For instance for 3 columns. This array will have 20 rows...
10
by: nospam | last post by:
Hello! I can pass a "pointer to a double" to a function that accepts double*, like this: int func(double* var) { *var=1.0; ... }
6
by: Carl | last post by:
Hi, I want to pass an array of object of different type to a function and use it in the function. I am not able to have it working. Function that create the array... public virtual DataSet...
2
by: frankh | last post by:
With Marshal you can copy data from a one-dimensional array to BitmapData.Scan0. What do I do if my array is two-dimensional? Or, alternatively, can I create somehow two variables byte arr1; ...
33
by: Peace | last post by:
I am having trouble writing code to turn an array into a delimited string. Dim splitout As String splitout = Join(DataArray(rows, columns), " ") rows and columns are integers representing rows...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
3
by: Eric Lilja | last post by:
Assignment: Create a 3x4 2-dimensional array of integers. Populate each element using some non-random scheme so that no two elemens contain the same value. Then create two functions for printing...
8
by: per9000 | last post by:
Hi all, I have a two-dimensional array of data, f.x int's. We can imagine that the array is "really large". Now I want the data in it and store this in a one-dimensional array. The obvious...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.