Hi,
I am a C programmer trying to figure out a simple way of defining a 2D
array.
In C i would simply do:
int dateArray[5][3] = {5,21,2004,
7,23,1979,
5, 6,1949,
6, 2,1977,
2,15,1975};
In java however I am not sure how to do this. From what I have read so
far I know of one way.
int[][] dateArray = new int[5][3];
dateArray[0][0] = 5;
dateArray[0][1] = 21;
dateArray[0][2] = 2004;
....
Is there a quicker way to do this, similar to C.
Thanx
Joe 1 2761
"Joe Ray" <ra****@hotmail.com> wrote in message
news:46*************************@posting.google.co m... Hi,
I am a C programmer trying to figure out a simple way of defining a 2D array. In C i would simply do:
int dateArray[5][3] = {5,21,2004, 7,23,1979, 5, 6,1949, 6, 2,1977, 2,15,1975};
In java however I am not sure how to do this.
It is the same in java, but you need extra curleys.
int x[][] = {{1,2,3}, {2,3,4}};
And you don't need to specify the size unless you want to.
From what I have read so far I know of one way.
int[][] dateArray = new int[5][3]; dateArray[0][0] = 5; dateArray[0][1] = 21; dateArray[0][2] = 2004; ...
Is there a quicker way to do this, similar to C.
Thanx
Joe This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of...
|
by: VK |
last post by:
A while ago I proposed to update info in the group FAQ section, but I
dropped the discussion using the approach "No matter what color the cat
is as long as it still hounts the mice". Over the last...
|
by: simkn |
last post by:
Hello,
I'm writing a function that updates an array. That is, given an
array, change each element.
The trick is this: I can't change any elements until I've processed
the entire array. For...
|
by: yeti349 |
last post by:
Hi, I'm using the following code to retrieve data from an xml file and
populate a javascript array. The data is then displayed in html table
form. I would like to then be able to sort by each...
|
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...
|
by: Michael |
last post by:
Hi,
I am trying to pass a function an array of strings, but I am having trouble
getting the indexing to index the strings rather than the individual
characters of one of the strings.
I have...
|
by: buuuuuum |
last post by:
why array can't be assigned, like structs?
|
by: =?Utf-8?B?U2hhcm9u?= |
last post by:
Hi Gurus,
I need to transfer a jagged array of byte by reference to unmanaged
function, The unmanaged code should changed the values of the array, and when
the unmanaged function returns I need...
|
by: chiefychf |
last post by:
I'm working on a school project and I am having a few issues... The program calls for three arrays a,b,c that have to be sorted, then compared to even or odd and stored in arrays d & e, then merge...
|
by: Slain |
last post by:
I need to convert a an array to a multidimensional one. Since I need
to wrok with existing code, I need to modify a declaration which looks
like this
In the .h file
int *x;
in a initialize...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |