473,738 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

3 Dimension Array assignment dynamically

1 New Member
How Can I assign 3-D array dynamically
Sep 27 '12 #1
1 1551
iam_clint
1,208 Recognized Expert Top Contributor
not sure what you are actually asking to do but this should answer the question?
Expand|Select|Wrap|Line Numbers
  1. var test = new Array (4);
  2. for (var i = 0; i < test.length; i++) {
  3.     test[i] = new Array(4);
  4. }
  5. for (var i = 0; i < test.length; i++) {
  6.      for (var c = 0; c<test[i].length; c++) {
  7.         test[i][c] = 'some data? x'+i+' y'+c;
  8.     }
  9. }
  10. alert(test[1][3]);
  11.  
Sep 27 '12 #2

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

Similar topics

4
1918
by: Michael Kirchner | last post by:
Hi everybody The output of my multiple dimension array is quite confusing. Im declaring an array, store some values in it and then I save the array in a session variable. On an other page I store the data of the session in a new multiple dimension array. All data are saved correctly in the array of the 1st page. But in the new array of the 2nd page there is only one entry. Does anybody knows
9
7764
by: James | last post by:
Hi, I am new to C++. I want to directly create a dynamic two-dimension double array, i.e. double pp. I found the "new" is only for one-dimension array, i.e. double *p = new p. How to "new" a two-dimension array? Is the only way to create a class? In java, I can easily create a two-dimension array by "double pp = new double". But, how to do it in C++?
6
2234
by: Adam Hartshorne | last post by:
The input to a function of a 3rd party library I want to use requires a double**, which is a multi-dimension array of doubles. I have looked on the net etc and seen several ways of supposedly doing this, but I don't seem to be able to get them to work. I was wondering if anybody can tell me what I am doing wrong. int rows = 10 ; int cols = 10 ;
0
1100
by: Hai Ly Hoang | last post by:
Hi, I'm using VC++ 7.0 (VS 2003). My code: void main() { int *a = new int; } I'm sure that the above code is accepted by VC++ (no compiling error). What is exactly the semantic of the above code ? Is is an implicit conversion from multi-dimension array to 1-dimension array ? If yes, what is it usage ?
4
4335
by: Bill Sun | last post by:
Hi, All I have a conventional question, How to create a 3 dimension array by C language. I see some declare like this: int *** array; int value; array = create3Darray(m,n,l);
3
4552
by: tg | last post by:
How can I sort a two-dimension array on the first dimension in the array? If there's not a way to do it, how can I return the values of the first dimension so that I can sort the values myself (bubble sort, etc.)? Thank you
27
3237
by: lovecreatesbea... | last post by:
This code snippet is an exercise on allocating two dimension array dynamically. Though this one is trivial, is it a correct one? Furthermore, when I tried to make these changes to the original example: for (i = 0; i < ROW + 2; ++i){ /*line 14*/ strcpy(array, "C! C!"); /*line 15*/ Apparently, the modified code wrote to the memory unit outside the allocated array, but the program ran well and there was no Segmentation
7
3207
by: lovecreatesbea... | last post by:
Is it always legal to cast expressions of type of multi-dimension array to type of pointer? Including: T to T* , T to T* , T to T* , and so on... For example: int *mtxrot1d(int *p, int n);
5
5207
by: geolinc | last post by:
What code do I use to find the lowest and the highest value in a two dimension array. I have written the code to have a user enter values into the array, as well as getting a total and average of all values in the array. This is the last part of an assignment due on 04/22/2010. Thank you!
2
1137
by: jasim88 | last post by:
Hello Every one I have a one dimension array and i want to check for every possible combination of unknown number. for example if i have a; and i want combination of three lines (not always three) like..
0
8968
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.