473,396 Members | 2,139 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,396 software developers and data experts.

array holding 2D arrays

hi
i am trying to store a bunch of 2D array objects (I have a class called
DoubleArray2D) in a simple 1D array. Can someone point me towards how I
should begin doing this.

Thanks a lot.

Jul 27 '06 #1
5 1387
malla wrote:
i am trying to store a bunch of 2D array objects (I have a class
called DoubleArray2D) in a simple 1D array. Can someone point me
towards how I should begin doing this.
What does 'DoubleArray2D' look like? Do you know how to declare
a simple single-dimensional array of, say, 'int'? What's stopping
you from replacing 'int' with your 'DoubleArray2D'?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 27 '06 #2
malla wrote:
hi
i am trying to store a bunch of 2D array objects (I have a class called
DoubleArray2D) in a simple 1D array. Can someone point me towards how I
should begin doing this.
What about std::vector< DoubleArray2D >?
Best

Kai-Uwe Bux
Jul 27 '06 #3

Kai-Uwe Bux wrote:
malla wrote:
hi
i am trying to store a bunch of 2D array objects (I have a class called
DoubleArray2D) in a simple 1D array. Can someone point me towards how I
should begin doing this.

What about std::vector< DoubleArray2D >?
Best

Kai-Uwe Bux
Thanks a lot,

I tried this and it worked.

Jul 27 '06 #4

Victor Bazarov wrote:
malla wrote:
i am trying to store a bunch of 2D array objects (I have a class
called DoubleArray2D) in a simple 1D array. Can someone point me
towards how I should begin doing this.

What does 'DoubleArray2D' look like? Do you know how to declare
a simple single-dimensional array of, say, 'int'? What's stopping
you from replacing 'int' with your 'DoubleArray2D'?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Thanks for replying.

I am going to use vector for this. But thanks for pointing out arrays.
I dont really know how to create a multiple array in C++. also can I
create an array that will hold anything in any variation?

Jul 27 '06 #5
malla wrote:
[..]
I dont really know how to create a multiple array in C++.
What book on C++ are you reading that doesn't cover arrays?
also can I
create an array that will hold anything in any variation?
I don't understand the question. "Anything"? Do you mean,
like a list in Python? No, you cannot. An array in C++ has
its type, and all elements of that array are of the same type.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: rl | last post by:
Hi out there, I'd like to know sth about the costs of a function call in php and the handling of character arrays (init size, enlargement steps of allocated memory, technique on enlargement ->...
14
by: dam_fool_2003 | last post by:
Friends, cannot we malloc a array? So, I tried the following code: int main(void) { unsigned int y={1,3,6},i,j; for(i=0;i<3;i++) printf("before =%d\n",y); *y = 7; /* 1*/
5
by: Richard Delorme | last post by:
The n869 draft says: J.2 Undefined behavior The behavior is undefined in the following circumstances: -- An array subscript is out of range, even if an object is ...
15
by: Gregg Woodcock | last post by:
My compiler (m68k-gcc) does not allow this (simplified example; not my real code) and I don't see why not: { char *arrayCharPtr1 = {"a", "ab", NULL}; char *arrayCharPtr2 = {"A", "AB", NULL};...
3
by: Faustino Dina | last post by:
Hi, The following code is from an article published in Informit.com at http://www.informit.com/guides/content.asp?g=dotnet&seqNum=142. The problem is the author says it is not a good idea to...
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...
7
by: rhitz1218 | last post by:
Hi all: Is it possible to store an integer array to another integer array? Or should I use an array of pointers that will point to a particular array? Thanks for the help.
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
17
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...
6
by: =?Utf-8?B?QWxleGFuZGVyZmU=?= | last post by:
Hi, I have a C# program that uses an unmanaged dll that has a function similar to the signature below : void f(out MyStruct arr, out int num); // num = actual array length returned The array...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.